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
bchager6
Super User
Super User

Calculate the difference between 2 measures with changing signs

Hi All...

 

I'm stumped with this one. I created 2 What If parameters that I bake in to each measure below. In a clustered column chart I'd like to show the original Revenue as a column and then the Revenue net of any % changes in Price and Demand.

 

The challenge lies in the fact that the Price or Demand % changes can be either positive or negative. So while a +10% increase in price minus a 5% decrease in demand (10-5) is easy to calculate, I'm stumped on how to write something that could also handle changing signs, like a 10% decrease in price with a 5% increase in demand (-10+5). Im thinking that I may need to use variables.

 

Any thoughts?

 

Revenue after % Price Change =
SUMX('Item Sales','Item Sales'[Net Sales])
+ SUMX('Item Sales','Item Sales'[Qty] * ('Item Sales'[Price]
* '% Price Change'[% Price Change Value]/100))
 
Revenue after % Demand Change =
SUMX('Item Sales','Item Sales'[Net Sales])
+ SUMX('Item Sales','Item Sales'[Qty] * '% Demand Change'[% Demand Change Value]))
* 'Item Sales'[Price]/100)
1 ACCEPTED SOLUTION

@bchager6 solution attached, you can tweak it as per your need. There are some other stuff, just ignore that.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

8 REPLIES 8
parry2k
Super User
Super User

@bchager6 is this what you are looking for?

 

Qty = 50

Price = 5

Price Increate = 10%

Demand Decrease = 10%

 

New Demand = Qty - % Demand Decrease = 50 - 10% = 45 (new demand)

Price Increase = Price + 10% Price Increate = 5 + 5% = $5.25

 

New Value = 45 x $5.25 = 236.25 (original number is 50 x $5 = 250)

 

Is this correct understanding?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thank you for your reply. That's correct, and the solution also needs to handle the scenario where the price decreases and demand increases.

@bchager6 solution attached, you can tweak it as per your need. There are some other stuff, just ignore that.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

That's brilliant!

 

My Actual Value and Demand Value, when the Price Change and Demand Change parameters are both set to 0, are much higher than my baseline revenue value though (Qty * Price directly from the source data). I suspect that it has something to do with the Actual Price measure because when I change it from Actual Price = MAX ( 'My Table'[Price] ) to Actual Price = AVERAGE ( 'My Table'[Price] ) for example, both the Actual Value and Demand Value are almost equal to my baseline revenue value.

 

Any idea what's happening here?

 

@bchager6 if possible share pbix file with explanation and I can take a look. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks for your time here. Here is a link to the .pbix. I'm not able to attach files for some reason.

example.pbix 

@bchager6 so I just looked at pbix, so changing MAX ( Price ) to Average (Price) works as expected, what challenge you see there, or what number is wrong, I'm not fully clear?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I'm good actually. Thank you so much for your help!

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.