Forum Discussion
Variance between current and last year based on a year slicer from Calendar Table
- Anonymous1 year ago
Hi Anonymous
I conduct the following tests based on the data you provided and some of the content described in the original article:
Calls Received Variance % = VAR Up_Arrow = UNICHAR(9650) VAR Down_Arrow = UNICHAR(9660) VAR SelectedYear = SELECTEDVALUE('Calendar Table'[Year-Global Filter]) VAR SelectedCallsReceivedLY = CALCULATE( SUM('Table1'[Value]), 'Table1'[Year] = SelectedYear - 1, 'Table1'[Indicator] = "Number of calls received" ) VAR CallsReceivedCurrentYear = CALCULATE( SUM('Table1'[Value]), 'Table1'[Year] = SelectedYear, 'Table1'[Indicator] = "Number of calls received" ) VAR Difference = CallsReceivedCurrentYear - SelectedCallsReceivedLY VAR CallsReceivedPercentage = FORMAT( DIVIDE(Difference, SelectedCallsReceivedLY, 0), "0.0%" ) RETURN IF( Difference < 0, "-" & CallsReceivedPercentage & " " & Down_Arrow & " from LY", "+" & CallsReceivedPercentage & " " & Up_Arrow & " from LY" )Here is the result.
Hope this helps you.
Regards,
Nono Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
A proper calendar table is based on a Date column as the primary key, and uses 1:* relationships. Once you have that corrected you can use the standard time intelligence DAX functions.
lbendlin I do have a date column in The Calender table but I used the index column in the calender table to connect to the other tables while also needing to use the calender table Year to slice. That is of an unual scenario I agree but that was given. Any thought on how to improve the above data model shared based on given scenario and tables provided.