Reply
Regular Visitor
Posts: 31
Registered: ‎11-17-2016
Accepted Solution

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)?


Accepted Solutions
Moderator
Posts: 9,938
Registered: ‎03-10-2016

Re: How to calculate difference after different filter settings..?

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.
1.PNG

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]
2.PNG


Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post


All Replies
Moderator
Posts: 9,938
Registered: ‎03-10-2016

Re: How to calculate difference after different filter settings..?

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.
1.PNG

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]
2.PNG


Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Regular Visitor
Posts: 31
Registered: ‎11-17-2016

Re: How to calculate difference after different filter settings..?

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!