Forum Discussion
Incorrect Measure Totals
- 5 years ago
Try the following formula
Available Inventory = SUMX(VALUES ( 'items'[Item_Number] ), CALCULATE ( SUM ('items'[Inventory])))
-
SUMX(VALUES ( 'items'[Item_Number] ), CALCULATE ( SUM ('Sales_Lines'[Quantity on SO])))
That didn't work. These are the column headers if that helps.
Change 'items'[Item_Number] to No .. name of first field.
If you could share the file that would be even better. Mask any sensitive data
- olivere915 years ago
Helper I
Yeah, I replaced the 'items'[Item_Number] to No. Sorry I'm very new at this I don't know how to mask.
- olivere915 years ago
Helper I
I fixed it! the measure now reads:
Available Inventory = SUMX(VALUES ( 'items'[No] ), CALCULATE ( SUM ('items'[Inventory])))-SUMX(VALUES ( 'items'[No] ), CALCULATE ( SUM ('Sales_Lines'[On Open SO])))Can you explain why my original measure wasn't working every time?- themistoklis5 years ago
Community Champion
Hello olivere91 ,
An article that explains the issue, is the following:
https://blog.enterprisedna.co/why-your-total-is-incorrect-key-power-bi-concept/
It has to do with how PowerBi read the context especially if you have filters applied.
SUMX is an iterator and it reads data row by row
Values function makes sure that every row displayed in the table will be read