Forum Discussion

JesusPenelas's avatar
JesusPenelas
Frequent Visitor
3 years ago
Solved

Measure with a value filter calculated previously in a virtual table (generated with slicer filter)

Hello,   I have the following data model:   I need to create a measure that adds the sales from the FactSales table, but only when a store is "LFL", which is defined according to calculatio...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  JesusPenelas ,

     

    Here are the steps you can follow:

    1. Create measure.

    Flag =
    var _select=SELECTCOLUMNS('DimCalendar',"MonthID",[Month_ID])
    var _table=
    FILTER('Fact_LFL_Store','Fact_LFL_Store'[Month_ID] in _select && [LFL_YN]<>1)
    var _column=SELECTCOLUMNS(_table,"Date",[STORE_ID])
    return
    IF(
       NOT( MAX('FactSales'[STORE_ID])) in _column && MAX('FactSales'[Month_ID]) in _select,1,0)
    Sum_Measure =
    SUMX(ALLSELECTED('FactSales'),[SALES])

    2. Place [Flag]in Filters, set is=1, apply filter.

    3. Result:

    Select 202208 202209 202210:

    Select 202207 202208 202209:

     

     

    Best Regards,

    Liu Yang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly