Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

YTD % DAX calculation.

Hi  - I hope someone can help me. I am lookign to calculate YTD%, (which is basically supposed to be -- (CurrentQ - prior 12/31) / prior 12/31) ).  I have used quick measure to calculate QoQ %, whic...
  • Tutu_in_YYC's avatar
    Tutu_in_YYC
    4 years ago

    My mistake, previous calculations will not work in your model.
    try this:

    YoY% for YTD = 

    IF(
        ISFILTERED('Data2'[Date]),
        ERROR("Time intelligence quick measures can only be grouped or filtered by the Power BI-provided date hierarchy or primary date column."),
        VAR __PREV_YEAR = CALCULATE(TOTALYTD(SUM('Data2'[$]), 'Data2'[Date].[Date]), DATEADD('Data2'[Date].[Date], -1, YEAR))
        RETURN
        DIVIDE(TOTALYTD(SUM('Data2'[$]), 'Data2'[Date].[Date]) - __PREV_YEAR, __PREV_YEAR)
    )


    This will compare the current YTD accumulation to previous year YTD and calculate the YOY growth.