Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

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:

SKUClassificationQuantityYearMonth
ABCCurrent Forecast9920234
ABCCurrent Forecast10020235
DEFCurrent Forecast12020236
ABCForecast M-18020234
ABDForecast M-18020235
DEFForecast M-19020236
ABCForecast M-25020234
ABDForecast M-210020235
DEFForecast M-210020236

 

 

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 = 

Calculate(
                SUM ('Demand Database'[Quantity]),
                    ALL('Demand Database'[Classification]),
                    ('Demand Database'[Classification]="FCST Curr Month")
 
Calculate forecast for comparison = 
            Calculate(
                SUM ('Demand Database'[Quantity]),
                    ALL('Demand Database'[Classification]),
                    'Demand Database'[Classification] = SELECTEDVALUE('Demand Database'[Classification])


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

  • 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's avatar
      Sahir_Maharaj
      Icon for Super User rankSuper 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])
      )
      • Anonymous's avatar
        Anonymous
        Not 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's avatar
      Sahir_Maharaj
      Icon for Super User rankSuper 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's avatar
      Sahir_Maharaj
      Icon for Super User rankSuper User

      For example, your total current forecast measure could be modified as follows:

  • 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.

  • These modifications should ensure that the measures are correctly filtered at the SKU level for the selected period.

  • 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.

  • 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.