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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
danielboi
Helper I
Helper I

Measure with IF renders useless results

Hello everybody,

 

I am working on a model where I compare budget sales planning with actual sales.

 

The model looks like this (streamlined version)

 

danielboi_0-1644500854834.png

In Fact Actual Sales I have measures to calculate the total revenue sum(Sales Revenue), volume sum(Sales Volume) and average price (Revenue / Volume), the fact budget sales table has same measures for the budget info.

 

For one formula I need to calcuate:

(Actual Price - Budget Price) * Actual Volume. This measure works perfectly. However, I need this calculation to be done only if Budget Price is 0.

This is where all the problem start. Run time very long and then I get a table (using excel right now) where all the attributes used (Customer, Material Number, Material Group, Currency) get copied down countless times and no values are shown. I tried various ways with defining variables before or having the separate calculation steps in separate measures (which on its own work fine!), but once it gets in an if statment it doesn't deliver expected result.

 

Thanks upfront

D

1 ACCEPTED SOLUTION

Thank you Ankit. just around the time when you posted your suggestion I figured out that I had the order of my sumx and if formulas wrong. Before I put the sumx function into the then and else of the if statement. Actually needs to be the other way round.

View solution in original post

2 REPLIES 2
AnkitKukreja
Super User
Super User

Hi! @danielboi 

 

1) Create a function or custom column with condition, if Budget is 0, 'Yes', 'No'.
2) Then you can use your measure with filter condition only on where budget was 0.

 

I hope it helps. Please share some sample data with expected result so I can share the output.

 

For Power BI trainings or support dm or reach out to me on LinkedIn.
If my response has successfully addressed your question or concern, I kindly request that you mark this post as resolved. Additionally, if you found my assistance helpful, a thumbs-up would be greatly appreciated.

Thanks,
Ankit Kukreja
www.linkedin.com/in/ankit-kukreja1904

Thank you Ankit. just around the time when you posted your suggestion I figured out that I had the order of my sumx and if formulas wrong. Before I put the sumx function into the then and else of the if statement. Actually needs to be the other way round.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Users online (3,194)