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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Moe_M
Regular Visitor

formula returns -100% when trying to get a delta value current yr vs past year

Hi,

 

I am trying to calculate a delta for a metric (this yr vs past year). delta = (TY/PY)-1.
If the PY value does not exist for an instance, it will give me an 'infinity' error. I was able to fix that with IFERROR function. but if TY value does not exist for an instance, I will get a -100% which is technically not an error and it will throw off the result for the next up hierarchy. what can I do about this? Thank you 

IFERROR((CALCULATE([sales],table,table[year] = 2023)/CALCULATE([sales],table,table[year] = 2022)-1),0)
1 REPLY 1
amitchandak
Super User
Super User

@Moe_M , prefer a divide function

divide(CALCULATE([sales],table,table[year] = 2023),CALCULATE([sales],table,table[year] = 2022),0)

 

Also, use a date table and time intelligence 

 

with separate year/date table

 

Time Intelligence, Part of learn Power BI https://youtu.be/cN8AO3_vmlY?t=27510
Time Intelligence, DATESMTD, DATESQTD, DATESYTD, Week On Week, Week Till Date, Custom Period on Period,
Custom Period till date: https://youtu.be/aU2aKbnHuWs&t=145s


Power BI — Year on Year with or Without Time Intelligence
https://medium.com/@amitchandak.1978/power-bi-ytd-questions-time-intelligence-1-5-e3174b39f38a
https://www.youtube.com/watch?v=km41KfM_0uA

 

//Only year vs Year, not a level below

This Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])))
Last Year = CALCULATE(sum('Table'[Qty]),filter(ALL('Date'),'Date'[Year]=max('Date'[Year])-1))
diff = [This Year]-[Last Year ]
diff % = divide([This Year]-[Last Year ],[Last Year ])

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

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!

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

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