Forum Discussion

ngomes's avatar
ngomes
Helper II
4 years ago
Solved

Data segmentation

Good morning everyone, I need to compare the last month with the previous one but I would like to use a data segmentation with the months and I would like to know what the last month is, getting the...
  • ngomes's avatar
    ngomes
    4 years ago

    Thank you for your help

    I ended up solving it with the formula:


    FILTER ( ALL ( Sales[Year] ), Year_1 = Sales[Year] )

     

     

    in the end it looked like:

     

    VAR MonthYear =
    Sales[YearselectedMonth2]
    VAR Year_1 =
    Sales[Selected Year 2-1]
    RETURN

    CALCULATE (
    Sum(Sales[Margin]) ,
    FILTER ( ALL ( Sales[Year] ), Year_1 = Sales[Year] )
    )