Forum Discussion
Dax formula - Live Data Calculated Column workaround
I'm trying to create a new measure in PowerBI to correctly capture current inventory totals. I'm dealing with a live connection so I am unable to create a calculated column for this solution. My goal is to correctly capture the total inventory for all plants.
Background:
We have 39 plants around the US that are supposed to enter in inventory at the end of each day. The problem is that some days the plants are too busy and forget so nothing is entered, so the inventory total for that plant is blank.
Data:
The problem with my solution is that because the total inventory for day 6 is not blank, the inventory 56 measure will pull that total, instead of summing the new column.
| ParentServiceProviderName | Daily A Pallet Total 56 | Daily A Pallet Total 6 | Daily A Pallet Total 5 |
| Denver | 50 | 50 | 40 |
| Boston | 30 | 30 | 25 |
| Atlanta | 20 | 20 | |
| Current Total | 80 | 80 | 85 |
| Correct Total | 100 | 80 | 85 |
5 Replies
- v-lili6-msftCommunity Support
hi, Anonymous
This looks like a measure totals problem. Very common. See this post about it here: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376
Also, this Quick Measure, Measure Totals, The Final Word should get you what you need:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907For your case, you could try formula as below:
newMeasure56 = var _table=SUMMARIZE(FactCycleCount,FactCycleCount[ParentServiceProviderName],"total",[Measure56]) return SUMX(_table,[total])
Result:
Best Regards,
Lin
- AnonymousNot applicable
Thank you for the reply. I'm currently digging through this information and am confident I'll be able to figure out a solution.
The solution provided has a semantic error at line 1, position 5, reported by Analysis Services: 'The syntax for '_Table' is incorrect'
newMeasure56 = var _Table = SUMMARIZE(FactCycleCount,DimServiceProvider[ParentServiceProviderName],"total",[Daily A Pallet Total 56]) return SUMX(_table,[total])
- AnonymousNot applicable
Edit: Now struggling to find a solution. I can't figure out why the above Dax expression won't work.
After searching through the forums I tried the solution below with no avail.
Mymeasure2 = IF(HASONEFILTER(DimServiceProvider[ParentServiceProviderName]), IF(FactCycleCount[Daily A Pallet Total 6] = BLANK(), FactCycleCount[Daily A Pallet Total 5], FactCycleCount[Daily A Pallet Total 6]), SUMX(FILTER(FactCycleCount, VALUES(DimServiceProvider[ParentServiceProviderName])), [Daily A Pallet Total 56]) )