cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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.

1 ACCEPTED SOLUTION
Community Support

Hi @ll0606 ,

Based on my testing, please try the following methods:

1.Create the sample table.

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.

4.The result is shown below.

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.

Community Support

Hi @ll0606 ,

Based on my testing, please try the following methods:

1.Create the sample table.

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.

4.The result is shown below.

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.

Announcements

#### Fabric certifications survey

Certification feedback opportunity for the community.

#### Power BI Monthly Update - April 2024

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

#### Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors