Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Need help - Column difference in a matrix

Good afternoon all!   I'm in dire need of some help.   I have the following matrix making use of 3 fields:   Description Period Cost My issue is the following, i want to add a column...
  • v-juanli-msft's avatar
    6 years ago

    Hi Anonymous 

    Create measures

    Measure 2 =
    VAR m1 =
        MINX (
            ALLSELECTED ( 'Table 2' ),
            [period]
        )
    VAR m2 =
        MAXX (
            ALLSELECTED ( 'Table 2' ),
            [period]
        )
    RETURN
        CALCULATE (
            SUM ( 'Table 2'[cost] ),
            FILTER (
                'Table 2',
                'Table 2'[period] = m2
            )
        )
            - CALCULATE (
                SUM ( 'Table 2'[cost] ),
                FILTER (
                    'Table 2',
                    'Table 2'[period] = m1
                )
            )
    
    
    Measure = IF(ISINSCOPE('Table 2'[period]),SUM('Table 2'[cost]),[Measure 2])

     

    Best Regards
    Maggie
    Community Support Team _ Maggie Li
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.