Forum Discussion

ZD1's avatar
ZD1
New Member
6 years ago
Solved

% change between week 1 and 2

Hi,   I would create a measure to work out % change between (% of calls answered - week 1) and (% of calls answered - week 2). Currently I have cards which show both figures seperately. But I'd lik...
  • v-xuding-msft's avatar
    6 years ago

    Hi ZD1 ,

    Please try like this:

    LastWeek =
    CALCULATE (
        SUM ( 'Table'[Sales] ),
        FILTER ( ALL ( 'Date' ), 'Date'[Week] = MIN ( 'Date'[Week] ) - 1 )
    )
    
    %Change = 
    VAR t =
        FILTER (
            SUMMARIZE (
                'Date',
                'Date'[Week],
                "Sales_", SUM ( 'Table'[Sales] ),
                "Last", [LastWeek]
            ),
            [Sales_] <> BLANK ()
        )
    VAR tt =
        FILTER (
            ADDCOLUMNS (
                t,
                "per", DIVIDE ( [Sales_] - [Last], [Sales_] ),
                "maxweek", MAXX ( t, [Week] )
            ),
            [Week] = [maxweek]
        )
    RETURN
        MAXX ( tt, [per] )

    You could download the attachment below. If this can't work, can you please share the sample data table and the expected result? Then we will understand clearly.