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 like to create a card which works out the % change and I've tried using the following measure but doesn't work...

 

% change Last Week vs This week
= SUM('Week 1'[% of Calls Answered] - SUM('Week 2'[% of Calls Answered]
/ SUM('Week 1'[% of Calls Answered]
* 100))

 

can someone help....

 

  • 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.

     

3 Replies

  • v-xuding-msft's avatar
    v-xuding-msft
    Icon for Community Support rankCommunity Support

    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.

     

    • v-xuding-msft's avatar
      v-xuding-msft
      Icon for Community Support rankCommunity Support

      Hi ZD1 ,

      Could you tell me if your problem has been solved? If it is, kindly mark the helpful answer as a solution if you feel that makes sense. Welcome to share your own solution. More people will benefit from the thread.

       

      Best Regards,

      Xue Ding

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