Forum Discussion

powerbi56's avatar
powerbi56
Frequent Visitor
4 years ago
Solved

Slicer

Hello, I am trying to add a slicer which compares the numbers from this year to the numbers from last years in a comparision visualation showing the past 12 months.    I have the DAX written for th...
  • v-yanjiang-msft's avatar
    4 years ago

    Hi powerbi56 ,

    According to your description, I create a sample.

    By your formula, get the same result as you described.

    Here's my solution, modify the formula like this:

    Last 12 before 12 =
    IF (
        [Last 12] = BLANK (),
        BLANK (),
        CALCULATE ( 'Data'[Total], SAMEPERIODLASTYEAR ( Data[Month] ) )
    )
    

    Get the expected result.

    I attach my sample below for reference.

     

    Best Regards,
    Community Support Team _ kalyj

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