Forum Discussion

MichaelB_MO's avatar
MichaelB_MO
Regular Visitor
1 year ago
Solved

YoY Calculations DAX formula Help

Good morning, I am trying to develop a YoY view.  I am currently utilizing the following formula: Previous Year Calls = calculate (distinctcount('Database 1'[Incident Number]), dateadd('Calendar Ta...
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi MichaelB_MO ,

    You want to calculate the growth rate of each year compared to the previous year, right? Here's an example of how I've used the sample data to help you.

    We first create a YEAR column so that we can do a better calculation, then we sum each year separately and do a year-over-year growth rate calculation.

    Current Year Calls = 
     CALCULATE(DISTINCTCOUNT('Table'[Incident Number]),ALLEXCEPT('Table','Table'[Year]))
    Previous Year Calls = 
    CALCULATE(
        DISTINCTCOUNT('Table'[Incident Number]),
        FILTER(
            ALL('Table'),
            'Table'[Year] = MAX('Table'[Year]) - 1
        )
    )
    YoY Growth Rate = 
    VAR CurrentCalls = [Current Year Calls]
    VAR PreviousCalls =[Previous Year Calls]
    RETURN
        IF(
            NOT(ISBLANK(CurrentCalls)) && NOT(ISBLANK(PreviousCalls)),
            DIVIDE(CurrentCalls - PreviousCalls, PreviousCalls, 0),
            BLANK()
        )
    

    If you have further questions, you can check my pbix file or feel free to reply to me, I will get back to you as soon as I hear from you, I would be honored if my solution solves your problem!

    Hope it helps!

     

    Best regards,
    Community Support Team_ Tom Shen

     

    If this post helps then please consider Accept it as the solution to help the other members find it more quickly.