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
Anonymous
Not applicable

DAX subtraction formula without summing up when there are multiple entries of the same category

Hello everyone,

I have a formula which does a basic subtraction:

MAX_LOAD_LENGTH minus LDM =
SUM('Truck_Info'[MAX_LOAD_LENGTH]) - SUM('Truck_Info'[LDM])
 
the max load length is the capacity and ldm is the load  with one row being one truck/drive. Now there can be multiple routes a day for the same truck when its a short route, meaning the truck 5 could exist 3 times. In this case the formula sums the values of those 3 entries and subtracts it. I don't want this even if it exists multiple times I still want it to only do it for that specific truck. I think i need to convert this to a calculated column to avoid the summing up when there are multiple entries of the same category.
example of data:
Truck | MAX_LOAD_LENGTH | LDM
5           10                                5
5           10                                3
5           10                                2


In the current situation the result would be:
Truck   |  FREE LDM
5              20

I want it to be like this
Truck  |   FREE LDM
5                5
5                7
5                8
1 ACCEPTED SOLUTION
Nathaniel_C
Super User
Super User

Hi @Anonymous ,
Your issue may be as easy as checking Don't Summarize, by clicking on the fields that you are bringing in. See pics. I also did another measure that you might use, although I think yours is fine. Measures are superior to doing a calculated column. 
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
Dontsum1.PNG

 

MAX_LOAD_LENGTH minus LDM 1 = 
MAX(mytable[MAX_LOAD_LENGTH]) - Max(mytable[LDM])

Dontsum.PNG

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
Nathaniel_C
Super User
Super User

Hi @Anonymous ,
Your issue may be as easy as checking Don't Summarize, by clicking on the fields that you are bringing in. See pics. I also did another measure that you might use, although I think yours is fine. Measures are superior to doing a calculated column. 
Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel
Dontsum1.PNG

 

MAX_LOAD_LENGTH minus LDM 1 = 
MAX(mytable[MAX_LOAD_LENGTH]) - Max(mytable[LDM])

Dontsum.PNG

 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.