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
Anonymous
Not applicable

Year-to-Year formula

Hello everybody,

 

I have a slight problem for my Year-to-Year formula. I want to calculate the evolution of sales from 2020 to 2021.

 

It goes as follows:

Conso Net Sales = SUM('DATA (2)'[CONSO NET SALES1])

 

- ConsoNetSales PY (Previous Year) = CALCULATE([Conso Net Sales],CALCULATETABLE(FILTER('DATA (2)','DATA (2)'[CONSO NET SALES1]),DATEADD('Calendar'[Date], -1,YEAR)))
 
- ConsoNetSales YOY (Year-to-Year) =
VAR ValueCurrentPeriod = [Conso Net Sales]
VAR ValuePreviousPeriod = [ConsoNetSales PY]
VAR Result =
IF(NOT ISBLANK(ValueCurrentPeriod) && NOT ISBLANK(ValuePreviousPeriod), ValueCurrentPeriod - ValuePreviousPeriod)
RETURN
Result

 

So everything works. The only problem is that for some of my clients, I don't have data for 2020 and therefore, it does not want to show up in my Waterfall graph.

I know also the solution: I just have to indicate PowerBI that if there is no Data for 2020 (Previous Year), it just has to substract the data of 2021 with 0.

 

But I don't know how to add that in YOY formula...

 

Can you please help me?

 

Thank you very much

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , based on what I got

 

ConsoNetSales YOY (Year-to-Year) =
VAR ValueCurrentPeriod = [Conso Net Sales]
VAR ValuePreviousPeriod = [ConsoNetSales PY]+0
VAR Result =
ValueCurrentPeriod - ValuePreviousPeriod
RETURN
Result

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , based on what I got

 

ConsoNetSales YOY (Year-to-Year) =
VAR ValueCurrentPeriod = [Conso Net Sales]
VAR ValuePreviousPeriod = [ConsoNetSales PY]+0
VAR Result =
ValueCurrentPeriod - ValuePreviousPeriod
RETURN
Result

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
Anonymous
Not applicable

Easy but efficient solution! Thank you very much

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

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.