'Is there a way to run a calculation based on Filter Box value in Apache Superset
I am working with Apache Superset, and I am trying to run a calculation in one column based on the selection of a Filter Box.
The Filter Box has two values in a dropdown list: Yes and No.
If the user selects Yes, I want to do a calculation on one of the columns (multiply by 1000 for example). When the user selects No, I want to show the column as is without any calculations.
So far, I managed to filter the data based on the Filter Box value. But I am not sure how to use a CASE Statement based on the Filter Box value.
Solution 1:[1]
You may leverage jinja template processing, for that you need to create a virtual dataset using SQL Lab View.
Select if({{filter_values('dropdown_key_column')}} == 'Yes',column * 1000, column) from db.tblname
and using explore create visualisation.
For more understanding watch similar youtube videos: Superset Videos
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ANIL PATEL |