Forum Discussion
olivere91
Helper I
5 years agoIncorrect Measure Totals
Hi, I'm having trouble with a measure giving inconsistent results: Available Inventory = SUM('items'[Inventory]) - SUM('Sales_Lines'[Quantity on SO]) Below is an exmaple, the top line is c...
- 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])))
olivere91
Helper I
5 years agoYeah, I replaced the 'items'[Item_Number] to No. Sorry I'm very new at this I don't know how to mask.
olivere91
Helper I
5 years agoI 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