Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
abertolett
Frequent Visitor

Quick Measure for change showing 0.00%

I can't get the quick measure to work for YOY (and probably any other unit).

 

CTR= 
IF(
ISFILTERED('Date'[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([CTR], DATEADD('Date'[Date].[Date], -1, YEAR))
RETURN
DIVIDE([CTR] - __PREV_YEAR, __PREV_YEAR)
)

 

If I try to use other date values, it starts throwing errors about using the Date Hierarchy.

 

I have a filter context displaying the rolled up CTR avgs for 2016, 2017, 2018.

 

I'm able to "hardcode" a filter like '2016' but I can't make it change along with the context of the visual.

1 ACCEPTED SOLUTION
v-xjiin-msft
Solution Sage
Solution Sage

@abertolett

 

Based on your measure, you are using DateAdd() function. Right?

 

By using DateAdd() function, you can refer to the MS article and will find out that “The result table includes only dates that exist in the dates column.” It also means that this function will only return the date which is existed in the original date column.

Please refer:

 

C.PNG

 

So, in your scenario, the issue that your measure is not working maybe related to the DateAdd() function is returning blank values. Please verify this.

 

And if you want to subtract a single year, you can try following measure:

 

MinusOneYear =
IFERROR (
    DATE ( YEAR ( TableName[Date] ) - 1, MONTH ( TableName[Date] ), DAY ( TableName[Date] ) ),
    BLANK ()
)

 

Thanks,
Xi Jin.

View solution in original post

1 REPLY 1
v-xjiin-msft
Solution Sage
Solution Sage

@abertolett

 

Based on your measure, you are using DateAdd() function. Right?

 

By using DateAdd() function, you can refer to the MS article and will find out that “The result table includes only dates that exist in the dates column.” It also means that this function will only return the date which is existed in the original date column.

Please refer:

 

C.PNG

 

So, in your scenario, the issue that your measure is not working maybe related to the DateAdd() function is returning blank values. Please verify this.

 

And if you want to subtract a single year, you can try following measure:

 

MinusOneYear =
IFERROR (
    DATE ( YEAR ( TableName[Date] ) - 1, MONTH ( TableName[Date] ), DAY ( TableName[Date] ) ),
    BLANK ()
)

 

Thanks,
Xi Jin.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.