Forum Discussion
Slicer and problem with measure
Dear gurus,
am having an issue with measure providing correct result at aggregated level but missing to display values at detailed level.
My database is simple:
| SKU | Classification | Quantity | Year | Month |
| ABC | Current Forecast | 99 | 2023 | 4 |
| ABC | Current Forecast | 100 | 2023 | 5 |
| DEF | Current Forecast | 120 | 2023 | 6 |
| ABC | Forecast M-1 | 80 | 2023 | 4 |
| ABD | Forecast M-1 | 80 | 2023 | 5 |
| DEF | Forecast M-1 | 90 | 2023 | 6 |
| ABC | Forecast M-2 | 50 | 2023 | 4 |
| ABD | Forecast M-2 | 100 | 2023 | 5 |
| DEF | Forecast M-2 | 100 | 2023 | 6 |
I need to compare the total Current Forecast for a user-defined period (I use a slicer on Year and Month) and a user-defined period (I use a slice on Classification)
I created following measures:
calculate total current forecast =
it works perfectly when aggregating the quantity to a higher level (e.g. Brand, which I've not included in the table above) but when I drill down at SKU level, some of the SKU are missing the Fcst CM value - even if the subtotal is correct.
It seems to me there's an issue with the display / visual at SKU level.
Anyone has an idea of how to display all values at SKU level?
11 Replies
- Sahir_Maharaj
Super User
Hello Anonymous,
It's possible that some SKUs are missing the Fcst CM value because they don't have any entries with that classification in the selected period.
To display all values at the SKU level, you may need to modify your measures to explicitly filter for the selected period at the SKU level, rather than relying on the ALL() function to remove the Classification filter.
- Sahir_Maharaj
Super User
calculate total current forecast = Calculate( SUM ('Demand Database'[Quantity]), FILTER('Demand Database', 'Demand Database'[Classification]="FCST Curr Month" && 'Demand Database'[Year]=SELECTEDVALUE('Demand Database'[Year]) && 'Demand Database'[Month]=SELECTEDVALUE('Demand Database'[Month]) )- AnonymousNot applicable
hello Sahir_Maharaj and thanks for your suggestions.
I tried with your formula with FILTERS, it doesn't work at all. The slicer on the comparison measure is blocking the measure to take the values of current month, so the query is totally empty.
I still believe that something like ALL function should be used to remove the slicer effect.
moreover, by using ALL function, at least I can extract some values at SKU level but again I have missing values if I select more than one month for the extraction of values - but the total is always correct so am wondering if there's any conflict between the slicer and the visual.if you've any other suggestion I'm happy to tried it out.
M
- Sahir_Maharaj
Super User
One way to do this is to use the FILTER() function to create a new table that includes only the selected period, and then use that table as a filter in your measure.
- Sahir_Maharaj
Super User
For example, your total current forecast measure could be modified as follows:
- Sahir_Maharaj
Super User
Another possibility is that there may be some data quality issues in your dataset, such as missing or incomplete data. You could try checking your data for any inconsistencies or gaps that may be causing the missing values.
- Sahir_Maharaj
Super User
These modifications should ensure that the measures are correctly filtered at the SKU level for the selected period.
- Sahir_Maharaj
Super User
You may also want to try using a different visual, such as a table or matrix, to see if the missing values are still present.
- Sahir_Maharaj
Super User
Additionally, you could try using a DAX query in a tool like DAX Studio to debug your measures and see exactly what data is being used in the calculations.
- Sahir_Maharaj
Super User
Let me know if you might need further assistance.