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

Help with DAX for correct total

Hello!

 

Need help with creating a measure with DAX to see correct totals for part number.

 

In this example table, one Part Number goes into several Models and sales (qty1) on each part remains same for a given month as part is not unique to the model. Sales of each Model does vary on a given month as shown below. So, we see repeated values for part numbers in a given date and different values for Models in the same rows.

 

Example Table - Each part is linked to specific model and is unique row.

kamsingh11_2-1653132339123.png

 

I am achieving accurate result for Part Number if we select one model at a time. However, it messes up in totals of parts, if we select more than one model or all models. It essentially aggregates all values of same part (repeated values are all aggregated). 

 

So, I am looking for a measure with DAX that can show the sum as single value of Part Number even when we choose multiple Models. Here is the .pbx file: https://drive.google.com/file/d/1psm3q_pHsQPLXVYPyqgkOyU_l4itnokM/view?usp=sharing

 

In below, if I select any part and any model, then I get right information as below.

kamsingh11_3-1653132339135.png

 

However, if I select any part & all models, then data for parts are also aggregated. For example, instead of seeing only 195 as Qty1, now we see 390.

kamsingh11_4-1653132339012.png

 

What can we do avoid summing up parts? Any speific measure that can be used to help here which considers only one value of Part Number. 

 

Any help will be highly appreciated here.

 

Thanks!

1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the attached file, that I inserted explicit measures into the visualizations.

 

Quantity one measure: = 
SUMX (
    SUMMARIZE ( 'Table', 'Table'[Part], 'Table'[Part Number], 'Table'[Qty1] ),
    'Table'[Qty1]
)

 

Quantity two measure: = 
SUMX (
    SUMMARIZE ( 'Table', 'Table'[Part], 'Table'[Part Number], 'Table'[Qty2] ),
    'Table'[Qty2]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


View solution in original post

2 REPLIES 2
Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the attached file, that I inserted explicit measures into the visualizations.

 

Quantity one measure: = 
SUMX (
    SUMMARIZE ( 'Table', 'Table'[Part], 'Table'[Part Number], 'Table'[Qty1] ),
    'Table'[Qty1]
)

 

Quantity two measure: = 
SUMX (
    SUMMARIZE ( 'Table', 'Table'[Part], 'Table'[Part Number], 'Table'[Qty2] ),
    'Table'[Qty2]
)

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Go to My LinkedIn Page


Anonymous
Not applicable

Thank you! 

Yes, this works great on this example table. I will try to test this on my huge table and let you know if I run into any issues. Thanks again!

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.