Forum Discussion
Anonymous
4 years agoNot applicable
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...
- 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.
Tutu_in_YYC
Super User
4 years agoDo you have a year slicer in the report? If yes, can you choose a year?
Anonymous
4 years agoNot applicable
Yes, i did choose a year and still getting 0 values.
- Tutu_in_YYC4 years ago
Super User
Can you create this for validation, and put it in the matrix? Upload a snapshot.
Validation =
VAR _Current = TOTALYTD(SUM(Data2[$]), Data2[Date])
VAR _Previous = CALCULATE( TOTALYTD(SUM(Data2[$]), Data2[Date]), SAMEPERIODLASTYEAR(Data2[Date]))
RETURN
_Current & "---" & _Previous- Anonymous4 years agoNot applicable
- Tutu_in_YYC4 years ago
Super User
That tells me that you do not have data for previous year. Is that the case?