Forum Discussion
Measure help
- 3 years ago
In trying to debug it by splitting it more up, it turned out to work.
Never tried a measure not working by using VAR.
So in my solution I just divided the DAX presented into 2 individual measures:Out of Stock status =VAR QtyAtS =SUMX(DISTINCT(DimItem[Item Number]),[Quantity available to Sell])RETURNIF(CALCULATE(QtyAtS) <= 0,1,0)Out of Stock count =COUNTROWS(FILTER(DISTINCT(DimItem[Item Number]),[Out of Stock status] = 1))
I then divided the Out of Stock count measure with a distinct count of Item Numbers and it works - a bit confused but at least it works.
My solution is going to be part of a cube, so summarize isn't really a solution for me cause of relationship issues.
I've gotten a bit further than last, but I've got issues with the sum of the measure I'm making. I've taken the measure I divide with to get the OOS share out as it doesn't have issues, so now I just want to summarize how many unique items are out of stock.
- scott_henderson3 years agoHelper II
Not 100% sure here, but my gut is telling me if you can get your above as a calculated column in the table, then do a simple sum on that column ? Is that an option ?
- Sperling3 years agoAdvocate II
Appreciate the input, but since items exist in multiple companies, the sum of the calculated column is more than 1 if the stock status is out of stock in several. So if it for example is out of stock in 6 companies, the sum will be 6 rather than 1.
- Sperling3 years agoAdvocate II
In trying to debug it by splitting it more up, it turned out to work.
Never tried a measure not working by using VAR.
So in my solution I just divided the DAX presented into 2 individual measures:Out of Stock status =VAR QtyAtS =SUMX(DISTINCT(DimItem[Item Number]),[Quantity available to Sell])RETURNIF(CALCULATE(QtyAtS) <= 0,1,0)Out of Stock count =COUNTROWS(FILTER(DISTINCT(DimItem[Item Number]),[Out of Stock status] = 1))
I then divided the Out of Stock count measure with a distinct count of Item Numbers and it works - a bit confused but at least it works.