Forum Discussion
Calculate variance in same column when filtered by different dates in two month slicers.
- Anonymous2 years ago
Hi aks_jo ,
Since you didn't provide sample data, I had to create a sample data myself to test it:And I suggest you to add two tables for slicers:
Without any relationships:
Then I use this DAX to create a measure:
Difference = VAR Month_From = SELECTEDVALUE(Slicer1[Month_From]) VAR Month_To = SELECTEDVALUE(Slicer2[Month_To]) VAR Value_From = CALCULATE( SUM('Table'[Actual TPD 1]), MONTH('Table'[Date]) = Month_From ) VAR Value_To = CALCULATE( SUM('Table'[Actual TPD 1]), MONTH('Table'[Date]) = Month_To ) RETURN Value_From - Value_ToAnd the final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi aks_jo ,
Since you didn't provide sample data, I had to create a sample data myself to test it:
And I suggest you to add two tables for slicers:
Without any relationships:
Then I use this DAX to create a measure:
Difference =
VAR Month_From = SELECTEDVALUE(Slicer1[Month_From])
VAR Month_To = SELECTEDVALUE(Slicer2[Month_To])
VAR Value_From =
CALCULATE(
SUM('Table'[Actual TPD 1]),
MONTH('Table'[Date]) = Month_From
)
VAR Value_To =
CALCULATE(
SUM('Table'[Actual TPD 1]),
MONTH('Table'[Date]) = Month_To
)
RETURN
Value_From - Value_To
And the final output is as below:
Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.