cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Johnlogistic Regular Visitor
Regular Visitor

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

Accepted Solutions
Super User IV
Super User IV

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

Hi @Johnlogistic ,
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
Super User IV
Super User IV

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

Hi @Johnlogistic ,
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

Helpful resources

Announcements
Exclusive LIVE Community Event #3 – Ask Arun Anything

Exclusive LIVE Community Event #3 – Ask Arun Anything

Join us in the third Triple A event!

Meet the 2020 Season 1 Power BI Super Users!

Meet the 2020 Season 1 Power BI Super Users!

It’s the start of a new Super User season! Learn all about the new Super Users and brand-new tiered recognition system.

Super User Challenge: Can You Solve These?

Super User Challenge: Can You Solve These?

We're celebrating the start of the New Super User season with our first ever Super User 'Can You Solve These?' challenge.

Power BI Desktop Update - February 2020

Power BI Desktop Update - February 2020

We are super excited for our update this month, as we are releasing two of our top community requests!

Power Platform Online Conference

Power Platform Online Conference

Join us for the first ever Power Platform Online Conference!

Top Solution Authors