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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Kartic21
Helper I
Helper I

Creating Year over Year sales but its giving infinite when clicked on particular year in trend chart

I am trying to create YoY% KPI but having issue when i click on partcular/one entering year on the chart it gives infnity.
sample data 

Kartic21_0-1693459823533.png

Formula :

Year over year perc =
var cy = max('Table'[Year])
var py = MAXX(ALL('Table'),'Table'[Year])-1
var cyenroll = CALCULATE([Totalenroll],FILTER('Table','Table'[Year]=cy))
var pyenroll = CALCULATE([Totalenroll],'Table','Table'[Year]=py)
return (cyenroll-pyenroll)/pyenroll
//(cyenroll-pyenroll)/pyenroll)


issue : when i click on any entering year in trend chart ,,its show infinty...it seems like it cant calculate pyenroll value

Kartic21_1-1693459998519.png

 



Can any please help on this..? Thanks



 

 

 

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

You should ideally create a Date column first (can be Jan 1 of tht row's year) and then a calendar Table.  From thereon, the calcualtions will become simple.  To receive further help, share some data to work with?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
lbendlin
Super User
Super User

instead of /  use DIVIDE  and provide an alternative result if the previous year's data is blank

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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