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

Measures Calculating Incorrectly at Line Level

Hello,

 

Hoping someone can help me.

I'm trying to do something very simple and basic in Power BI, yet each attempt using different methods is coming up incorrecct as well.

 

I have inventory items with a current quantity per each.  If I bring in the current quantity field and do not sum, it breaks it down to 4 lines with different amounts, however, when you add each line item, you get the correct sum.  Yet when you sum the the Quantity, it gives you a very incorrect result.  

 

My first screenshot shows the item, broken out into multiple lines as I've indicated, with a different quantity on each line.  The total of those is 130.

michelle077_0-1642179093402.png

Now, if I sum the quantity to get one line item for each item, this is what happens:

michelle077_1-1642179133058.png

The sum is clearly incorrect.  Some of the items are so badly incorrect (you can see the high numbers below the indicated line).

 

I have been searching for days trying to find a solution, yet each attempt I make is showing the data incorrectly.  Summarizing doesn't work, neither does group by; variables aren't working..............nothing helps.

 

Please help if you can!

Thank you!

 

Michelle

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

@AlexisOlson I was finally successful and was able to create the proper sum per item using this measure:

 

Current Qty = SUMX(SUMMARIZE(vw_TubingShortage_InventoryUsage,[Item Name],[CurrentQty]),[CurrentQty])

View solution in original post

It's doesn't make sense to me why that would necessarily be the "correct" sum but you could do something like this:

SUMX (
    SUMMARIZE ( Table1, Table1[Item Name], Table1[Current Qty] ),
    Table1[Current Qty]
)

 

View solution in original post

6 REPLIES 6
AlexisOlson
Super User
Super User

This definitely looks odd but it's hard to diagnose without seeing your file. Can you share a file that enables us to replicate the issue (either share your existing file with anything sensitive removed or create a new dummy file)?

Anonymous
Not applicable

https://1drv.ms/u/s!AmgBMZ-nup2SglCZBGmVEND39B1p?e=j8K0ND 

 

Here is a copy of the sample data.

Thanks.

 

What's happening is that in your first table, it's grouping distinct Item Name and Current Qty combination. Some of these combinations appear multiple times though, which is why they add up to a larger number than you expect.

 

If you add DATECHG to the table, it becomes more obvious what's happening.

AlexisOlson_0-1642692800246.png

Anonymous
Not applicable

@AlexisOlson thank you.

So how would I solve the issue of summing the amounts to reflect the correct value regardless of the date?  The sum should be 130.

 

Thank you.

It's doesn't make sense to me why that would necessarily be the "correct" sum but you could do something like this:

SUMX (
    SUMMARIZE ( Table1, Table1[Item Name], Table1[Current Qty] ),
    Table1[Current Qty]
)

 

Anonymous
Not applicable

@AlexisOlson I was finally successful and was able to create the proper sum per item using this measure:

 

Current Qty = SUMX(SUMMARIZE(vw_TubingShortage_InventoryUsage,[Item Name],[CurrentQty]),[CurrentQty])

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.