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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
walt20221
Frequent Visitor

Minus operator not working for my formula

Good Day Team,

I am testing the water with power bi and DAX and I think I got stuck in a little problem while putting my formula, so will be great if you can give me your feedbacks.

 

Here is my problem, I did create a measure to calculate:

1- REVENUE PER MOVEMENT wich is a division and the calculation is based on a condition.

2- also COST PER MOVEMENT which is a divisionand the calculation is based on a condition.

The statement 1 and 2 avobe are being calculated with the following statement and it works.

 

Base Measure =
IF(
HASONEVALUE(MainTable[Description]),
IF(
VALUES(MainTable[Description]) = "3) TOTAL REVENUE PER TEU",
DIVIDE(
CALCULATE(SUM(MainTable[Amt]), MainTable[Description] = "1) REVENUE BASE SLOTS" ),
CALCULATE(SUM(MainTable[Amt]), MainTable[Description] = "2) TOTAL TEUS" )
), IF( values(MainTable[Description]) = "4) COST PER TEU", DIVIDE(CALCULATE(SUM(MainTable[Amt]), MainTable[Description] = "1) TOTAL COSTS"), CALCULATE(SUM(MainTable[Amt]), MainTable[Description] = "2) TOTAL TEUS") ),
 
SUM(MainTable[Amt])))
 
Also I want to calculate the MARGIN and this is a challenge because is a substraction but my condition is not working, so not sure how to use the minus (-)
 

VALUES(MainTable[Description]) = "1) MARGIN PER TEU",                                                           CALCULATE(SUM(MainTable[Amt]), MainTable[Description] = "3) TOTAL REVENUE PER TEU") -                                  CALCULATE(SUM(MainTable[Amt]), MainTable[Description] = "4) COST PER TEU"),

  

Thanks

 

 

1 REPLY 1
AlexisOlson
Super User
Super User

I'm not sure what's happening but my best guess is that this is an auto-exists issue that could be resolved by using a dimension table for [Description].

 

For better help, please share some example data and a comparison of what you're currently seeing versus what you expect to see. Sharing a link to a copy of an example pbix you've uploaded to a cloud service like DropBox/GoogleDrive/SharePoint would be ideal.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors