Forum Discussion

ll0606's avatar
ll0606
New Member
2 years ago
Solved

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 ...
  • Anonymous's avatar
    Anonymous
    2 years ago

    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.