Forum Discussion

relliott's avatar
relliott
Frequent Visitor
5 years ago
Solved

Calculate difference between two periods while selecting one period from slicer

This question is similar to others, but I couldn't find any posts solving for the unique challenge I'm having.    I have a simple sales table with Rep, Quarter, and Sales. I want the report user to...
  • v-henryk-mstf's avatar
    5 years ago

    Hi relliott ,


    Try the following calculated column and measure:

    Q_ = IF(Sales[Quarter]="Q2",0,1)
    M1 = 
    VAR A =
        CALCULATE (
            MIN ( Sales[Sales] ),
            FILTER ( ALL ( Sales ), MAX ( Sales[Q_] ) = 0 )
        )
    VAR B =
        CALCULATE (
            MAX ( Sales[Sales] ),
            FILTER ( ALL ( Sales ), MAX ( Sales[Q_] ) = 1 )
        )
    RETURN
        CALCULATE ( B - A, FILTER ( ALL ( Sales ), MAX ( Sales[Rep] ) = Sales[Rep] ) )


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.


    Best Regards,
    Henry


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