Forum Discussion

kalkhudary's avatar
kalkhudary
Icon for Helper IV rankHelper IV
1 year ago
Solved

Variance between current and last year based on a year slicer from Calendar Table

Hello All,    I have a data model that includes 4 fact tables connected to a calender table through a YearMonth Index preserved on all the 4 fact tables and in the calender table. These tables are ...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi kalkhudary 

     

    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.