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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
Anonymous
Not applicable

p.p. change - Exclude where no data for current year

Hi All, 

 

I have a test PBI file where I am encountering an issue I cant quite solve. I am calculating the p.p. difference between scores across two  years and want to exclude any record for which there is no data for the most recent year (filtered).

 

The formula I am using is below, I need to exclude any record where there is no record for Year_New

 

Score p.p. YoY% = 
IF(
	ISFILTERED('TestData'[Year_New]),
	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(
			[Calc],
			DATEADD('TestData'[Year_New].[Date], -1, YEAR)
		)
	RETURN
			[Calc] - __PREV_YEAR
)

pbix file link below

1 ACCEPTED SOLUTION

Hi @Anonymous 

You may add IF conditon like below:

Score p.p. YoY% =
IF (
ISFILTERED ( 'TestData'[Year_New] ),
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 ( [Calc], DATEADD ( 'TestData'[Year_New].[Date], -1, YEAR ) )
RETURN
IF ( [Calc] <> BLANK (), [Calc] - __PREV_YEAR )
)

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

Link to pbix on dropbox (select the download button)

 

Test pbix file

Hi @Anonymous 

You may add IF conditon like below:

Score p.p. YoY% =
IF (
ISFILTERED ( 'TestData'[Year_New] ),
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 ( [Calc], DATEADD ( 'TestData'[Year_New].[Date], -1, YEAR ) )
RETURN
IF ( [Calc] <> BLANK (), [Calc] - __PREV_YEAR )
)

Regards,

Cherie

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

@v-cherch-msft 

 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors