Forum Discussion
How to calculate difference after different filter settings..?
Here is some background about my problem:
- I have two value columns in my data: value1 and value2. These both values are exaclty the same.
- I have two column chart visualizations in my report with month in axis. In the first visualization value is value1 and in the second visualization value is value2.
- I have two cost center slicers in my report. I control the first visualization with the slicer1 and the second visualization with slicer2.
For example:
- First visualization shows total value of 500 (cost center=asia)
- Second visualization shows total value of 300 (cost center=europe)
- Difference = 200
My problem is that I don't know how to calculate difference between my values. I think that I need to calculate difference after filtering. Is there anyway to do this (Tableua can handle this with paramenters)?
- Anonymous9 years ago
Hi tondeli,
What is your table structure and could you please share sample data of your table?
If your table is similar as follows, you can duplicate the current table in Query Editor, then filter the first table to contain only Europe data and the second table to contain only Asia data.
After that, create a column using the following DAX in europe table, then create a column chart as shown in the screenshot below.Difference = RELATED('asia'[Value1])-europe[Value1]
Thanks,
Lydia Zhang
2 Replies
- AnonymousNot applicable
Hi tondeli,
What is your table structure and could you please share sample data of your table?
If your table is similar as follows, you can duplicate the current table in Query Editor, then filter the first table to contain only Europe data and the second table to contain only Asia data.
After that, create a column using the following DAX in europe table, then create a column chart as shown in the screenshot below.Difference = RELATED('asia'[Value1])-europe[Value1]
Thanks,
Lydia Zhang- tondeliAdvocate I
Lydia, this was very helpful suggestion -thank you! I created dublicate fact table and dublicated all dimension tables aswell. I use these like two different solutions inside one data model. Now everything works!