Forum Discussion

dariog's avatar
dariog
Regular Visitor
5 years ago
Solved

Calculation based on filter selection

Hello Everyone, I have a problem. I have a table like the following:   Location     Sales North          10 South           11 West             9 East              15   I have a page filter ...
  • Anonymous's avatar
    Anonymous
    5 years ago

    Hi dariog ,

     

    Create a separate table by entering data

     

    This is the measure I created

    Result = 
    IF (
        SELECTEDVALUE ( 'Table (2)'[Category] ) = "Country",
        CALCULATE ( SUM ( 'Table'[Sales] ), ALL ( 'Table' ) ),
        CALCULATE (
            SUM ( 'Table'[Sales] ),
            FILTER ( 'Table', [Location] IN ALLSELECTED ( 'Table (2)'[Category] ) )
        )
    )
    

     

    Country is selected

     

    East and North are selected

     

    You check details from the attachment.

     

     

     

    Best Regards,

    Stephen Tao

     

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