Forum Discussion

ngct1112's avatar
ngct1112
Post Patron
5 years ago
Solved

Measure - Marginal different in a column

Hi, I have a measure to sum up the "Total Cost" (ASC) by its groups, may I know could I add one measure to calculate their %different comparing to upper value. Great thanks!

e.g. For group 2: 2970/2500-1 = 19%

GroupTotal CostChange%
12500 
2297019%
3345016%
4410019%
5486019%
  • ngct1112 , try like

    This = CALCULATE([Total Cost], FILTER(ALLSELECTED('Table'),'Table'[Group]=max('Table'[Group])))
    Last = CALCULATE([Total Cost], FILTER(ALLSELECTED('Table'),'Table'[Group]=max('Table'[Group])-1))

    diff = divide([This],[Last])-1

     

    But it will work better when group is in a separate diemenion/master table

2 Replies

  • ngct1112 , try like

    This = CALCULATE([Total Cost], FILTER(ALLSELECTED('Table'),'Table'[Group]=max('Table'[Group])))
    Last = CALCULATE([Total Cost], FILTER(ALLSELECTED('Table'),'Table'[Group]=max('Table'[Group])-1))

    diff = divide([This],[Last])-1

     

    But it will work better when group is in a separate diemenion/master table

  • ngct1112 

    Please add this as a measure:

    Cost Change % = 
    VAR _LASTGRP = MAX(Table9[Group])-1 
    VAR _LASTACOST = CALCULATE( [Total Cost], Table9[Group] = _LASTGRP)
    RETURN
    IF( ISFILTERED('Table9'[Group]),
        DIVIDE(
            [Total Cost] - _LASTACOST,
            _LASTACOST
        )
    )

    ________________________

    If my answer was helpful, please consider Accept it as the solution to help the other members find it

    Click on the Thumbs-Up icon if you like this reply 🙂

    YouTube  LinkedIn