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
aayush_a
New Member

KPI using a specific year as a trend

Hey, 

 

I am trying to create a KPI card on my dashboard and want my reference year (within the trend field) to always compare my current year to 2019 sales. So whatever year I filter my dashboard by, it should always compare my sales to 2019. 

 

Right now, I have it set as 

Revenue Period 2019 = CALCULATE((SUM(transactions[Total]) - SUM(transactions[Total_Tax])), PARALLELPERIOD(filter_date[Date], -3, YEAR))

This works when I set my filters to the year 2022 and it compares it to 2019, but when I change by filter to 2021, it begins comparing to the 2018 period. 

 

I also tried this method, 

Revenue Period 2019 = 
var _diff = 2019 - maxx(allselected('Date'), 'filter_date'[Year]) )
return
CALCULATE((SUM(transactions[Total]) - SUM(transactions[Total_Tax])), PARALLELPERIOD(filter_date[Date], _diff, YEAR))

But this doesn't work for me either. 

 

Any help on this will be very appreciated. 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@aayush_a , Also use date from date table in the measure

 

Revenue Period 2019 =
var _diff = 2019 - maxx(allselected('Date'), 'Date'[Year]) )
return
CALCULATE((SUM(transactions[Total]) - SUM(transactions[Total_Tax])), PARALLELPERIOD(Date[Date], -3, YEAR))

 

or

 

Revenue Period 2019 =
var _diff = 2019 - maxx(allselected('Date'), 'Date'[Year]) )
return
CALCULATE((SUM(transactions[Total]) - SUM(transactions[Total_Tax])), dateadd(Date[Date], -3, YEAR))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@aayush_a , Also use date from date table in the measure

 

Revenue Period 2019 =
var _diff = 2019 - maxx(allselected('Date'), 'Date'[Year]) )
return
CALCULATE((SUM(transactions[Total]) - SUM(transactions[Total_Tax])), PARALLELPERIOD(Date[Date], -3, YEAR))

 

or

 

Revenue Period 2019 =
var _diff = 2019 - maxx(allselected('Date'), 'Date'[Year]) )
return
CALCULATE((SUM(transactions[Total]) - SUM(transactions[Total_Tax])), dateadd(Date[Date], -3, YEAR))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

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!

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.