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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.