Forum Discussion
Measure showing zero when not filtered
- 5 years ago
Please try this expression instead. Not sure why you have the ALLSELECTED() in there and then filter it back down again with SELECTEDVALUE. In any case, the SELECTEDVALUE is why you were not seeing anything for total. I replaced it with VALUES. Also note that I updated your ALL to only include the columns being filtered (a good practice).
LY Stock (sgls) =
VAR currentFiscalYear =
MAX ( 'Stock & Sales'[fiscal_year] )
VAR currentFiscalWeek =
MAX ( 'Stock & Sales'[fiscal_week_number] )
RETURN
CALCULATE (
SUM ( 'Stock & Sales'[stock_sgls] ),
ALLSELECTED ( 'Stock & Sales'[bu] ),
FILTER (
ALL (
'Stock & Sales'[fiscal_year],
'Stock & Sales'[fiscal_week_number]
),
'Stock & Sales'[fiscal_year] = currentFiscalYear - 1
&& 'Stock & Sales'[fiscal_week_number] = currentFiscalWeek
),
VALUES ( 'Stock & Sales'[bu] )
)Regards,
Pat
Excellent! Thank you.
Noted on the ALL requirement.