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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. 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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.