Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculating Week over Week Percent Change

Hi All,

 

I am trying to calculate week over week change percentage and display the data in a weekly format. I am usng the below measure code 

 

Week Over Week = 
VAR todaycost = CALCULATE(
    COUNTROWS(Requests),
    FILTER(Requests,Requests[Request Type] = "Escalation"),
    DATEADD('DateTable'[Date],0,DAY)
    )
   
VAR LastWeek =
    CALCULATE (
        COUNTROWS(Requests),
        FILTER(Requests,Requests[Request Type] = "Escalation"),
        DATEADD('DateTable'[Date],-7, DAY)
    )
RETURN
   DIVIDE(todaycost-LastWeek,LastWeek, 0)
   

 

This displays the week over week change for the latest data when put on a card. However, when I try and break it out by weeknumber, nothing shows. I have gotten down to the problem line being


"FILTER(Requests,Requests[Request Type] = "Escalation")".  - When this line is removed, it works as expected.

 

However, in my table I have a column of status's and I only want the week over week change for the "Escalation" status. 

 

Here is a picture of my date table 

 

 

2020-12-02 18_55_31-Clipboard.png

 

1 ACCEPTED SOLUTION
Ashish_Mathur
Super User
Super User

Hi,

Ensure that to your visual, you drag Week of Year from the Date table.  Also, does this measure work?

Week Over Week = 
VAR todaycost = CALCULATE(
    COUNTROWS(Requests),
    Requests[Request Type] = "Escalation",
    DATEADD('DateTable'[Date],0,DAY)
    )
   
VAR LastWeek =
    CALCULATE (
        COUNTROWS(Requests),
        Requests[Request Type] = "Escalation",
        DATEADD('DateTable'[Date],-7, DAY)
    )
RETURN
   DIVIDE(todaycost-LastWeek,LastWeek, 0)

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Ensure that to your visual, you drag Week of Year from the Date table.  Also, does this measure work?

Week Over Week = 
VAR todaycost = CALCULATE(
    COUNTROWS(Requests),
    Requests[Request Type] = "Escalation",
    DATEADD('DateTable'[Date],0,DAY)
    )
   
VAR LastWeek =
    CALCULATE (
        COUNTROWS(Requests),
        Requests[Request Type] = "Escalation",
        DATEADD('DateTable'[Date],-7, DAY)
    )
RETURN
   DIVIDE(todaycost-LastWeek,LastWeek, 0)

Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

I was using Week of Year from the date table, but what fixed it was removing "Filter" and just using "Requests =". Thankyou very much!

You are welcome.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.