Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Get the value from a column based on a filter in another column

Hello,  I am trying to create a measure to get the sales value of two columns in another table that is linked to my fact table (previous month and previous scenario), so in the example below, for ke...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi  Anonymous ,

     

    Here are the steps you can follow:

    1. Create calculated column.

    Sell Previous Month  =
    var _m=
    MAXX(
        FILTER(ALL(DimMonth),'DimMonth'[Key]=EARLIER('fSales'[Key])&&'DimMonth'[Month ]=EARLIER('fSales'[Month])),[Previous_Month])
    var _Scenario=
    MAXX(
        FILTER(ALL(DimMonth),'DimMonth'[Key]=EARLIER('fSales'[Key])&&'DimMonth'[Month ]=EARLIER('fSales'[Month])),[Previous_Scenario])
    return
    MAXX(
        FILTER(ALL('fSales'),
    'fSales'[Month]=_m&&'fSales'[Scenario]=_Scenario),[Sales])

    2. Result:

     

    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