Forum Discussion

ryanmkan's avatar
ryanmkan
Regular Visitor
2 years ago
Solved

Combining dynamic information

Hello,   I have data that is structured like this CAT PERIOD AMOUNT a 1 x b 1 x c 1 x a 2 x b 2 x c 2 x a 3 x b 3 x c 3 x a 4 x b 4 ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi ryanmkan 

     

    For your question, here is the method I provided:

     

    Here's some dummy data

     

    "Table"

     

    Create measures.

     

     

    Measure = 
    IF(
        SELECTEDVALUE('Table'[CAT]) = "a" 
        || 
        SELECTEDVALUE('Table'[CAT]) = "b",
        CALCULATE(
            SELECTEDVALUE('Table'[AMOUNT]),
            FILTER(
                'Table', 
                'Table'[CAT] in {"a", "b"} && 'Table'[PERIOD] in {1, 2}
            )
        ),
        CALCULATE(
            SELECTEDVALUE('Table'[AMOUNT]), 
            FILTER(
                'Table', 
                'Table'[CAT] = "c" && 'Table'[PERIOD] in {3, 4}
            )
        )
    )
    

     

     

     

    Measure 2 = SUMX('Table', 'Table'[Measure])

     

     

    Create a matrix.

     

           

     

     

    Regards,

    Nono Chen

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