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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
elkjoperik
Helper II
Helper II

DAX formula for calculating growth / decline vs LY for gross margin

Hi!

I have all the data for the gross margin for this year and last year (two different columns). 

 

The tricky part is the the calculation gives 4 scenarios:

 

A. Postive / negative = negative, but it's realy a positive growth vs LY

B. Positive / positive = OK to calculate

C. Negative / negative = positive, but in reality it an be a positive or negative result.

D. Negative / positive =  negative 

 

I'm having a hard time writing a DAX formula that takes these four scenarios into consideration.

 

This years coulmn name = GM FY

Last years coulmn name = GM LY

1 ACCEPTED SOLUTION
v-yuezhe-msft
Employee
Employee

Hi @elkjoperik

From my point of view, it is a business logic issue rather than a DAX formula issue. And it is better to use the following formula to calculate gross margin growth/decline in your scenario.

Growth = ( (Table2[GM FY]-Table2[GM LY])/ABS(Table2[GM LY]))*100 & "%"


For mode details, please review the example in the attached PBIX file.

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-yuezhe-msft
Employee
Employee

Hi @elkjoperik

From my point of view, it is a business logic issue rather than a DAX formula issue. And it is better to use the following formula to calculate gross margin growth/decline in your scenario.

Growth = ( (Table2[GM FY]-Table2[GM LY])/ABS(Table2[GM LY]))*100 & "%"


For mode details, please review the example in the attached PBIX file.

Thanks,
Lydia Zhang

Community Support Team _ Lydia Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks a lot, solved the issue!

elkjoperik
Helper II
Helper II

bump, anyone ?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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