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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
ll0606
New Member

Weekly % Change DAX Formula Help

Hello,

 

I have a Power BI dashboard and I am trying to determine what is the % change from one week to the next. I have a Date Table and have created a relationship between the Date Table and the Date in my file and that works great.  

 

This is what I currently have. You will see it is a breakdown for different file sizes week over week beginning on 1/1/2024 through 4/8/2024.  I need to know the percentage change difference from one week to the next and display it like the "%Weekly Change" row you see. But the percentages you see are all incorrect and is just there as a placeholder.  

 

For example, the week of 1/1/2024 shows total rows of 243,419 the next week of 1/8/2024 shows total rows of 242,254. I need a DAX measure/formula that will help me calculate what was the percentage of change between the number of rows from the previous week to the current week. Each week starts on a Monday.  I will need this measure to continue throughout the rest of 2024, 2025, etc.  Is anyone able to help me figure this out? I appreciate any assistance I can get.

 

ll0606_0-1713213880770.png

 

1 ACCEPTED SOLUTION
v-jiewu-msft
Community Support
Community Support

Hi @ll0606 ,

Based on my testing, please try the following methods:

1.Create the sample table.

vjiewumsft_0-1713249887407.png

2.Create the measure to calculate the change between the previous week and current week.

 

weekly change = 
var date_ = SELECTEDVALUE('Table'[Date])
VAR current_sum =
CALCULATE (
        SUM ( 'Table'[Number]),
        FILTER(ALL('Table'), 'Table'[Date] = date_)
    )

VAR sum_preWeek =
CALCULATE (
        SUM ( 'Table'[Number]),
        FILTER(ALL('Table'), 'Table'[Date] = date_ - 7)
    )

VAR min_week = 
    CALCULATE(MIN('Table'[Date]), ALLSELECTED('Table'[Date]))
RETURN
IF(date_ = min_week, BLANK(), DIVIDE((current_sum - sum_preWeek ), sum_preWeek))

 

3.Drag the measure into the matrix visual. Change the data Format.

vjiewumsft_1-1713249930824.png

vjiewumsft_3-1713250074808.png

4.The result is shown below.

vjiewumsft_4-1713250091060.png

 

Best Regards,

Wisdom Wu

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

View solution in original post

1 REPLY 1
v-jiewu-msft
Community Support
Community Support

Hi @ll0606 ,

Based on my testing, please try the following methods:

1.Create the sample table.

vjiewumsft_0-1713249887407.png

2.Create the measure to calculate the change between the previous week and current week.

 

weekly change = 
var date_ = SELECTEDVALUE('Table'[Date])
VAR current_sum =
CALCULATE (
        SUM ( 'Table'[Number]),
        FILTER(ALL('Table'), 'Table'[Date] = date_)
    )

VAR sum_preWeek =
CALCULATE (
        SUM ( 'Table'[Number]),
        FILTER(ALL('Table'), 'Table'[Date] = date_ - 7)
    )

VAR min_week = 
    CALCULATE(MIN('Table'[Date]), ALLSELECTED('Table'[Date]))
RETURN
IF(date_ = min_week, BLANK(), DIVIDE((current_sum - sum_preWeek ), sum_preWeek))

 

3.Drag the measure into the matrix visual. Change the data Format.

vjiewumsft_1-1713249930824.png

vjiewumsft_3-1713250074808.png

4.The result is shown below.

vjiewumsft_4-1713250091060.png

 

Best Regards,

Wisdom Wu

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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

Top Kudoed Authors