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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
Anonymous
Not applicable

Week over Week change %

Hello,

 

I need to calculate Week over Week change %. 

 

i write the following DAX but red highlighted one has Error.

 

How should  i change the expression?

 

 

Week change =
VAR lastweekamount =
CALCULATE(
SUM(Power_BI_Book_Coin[R_Coin_Cnt]),
FILTER(
ALL(Power_BI_Book_Coin),
RELATED('Date'[WeekYear]
= MIN('Date'[WeekYear]-1))
)
)
RETURN
IF(lastweekamount = 0, "N/A",
DIVIDE(SUM(Power_BI_Book_Coin[R_Coin_Cnt]) - lastweekamount, lastweekamount, 0)
)
 

 Thanks.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please use the below formula 

 

Measure =
VAR lastWeekAmount =
    CALCULATE (
        SUM ( Value Sum),
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[WeekNum]
                = MIN ( 'Calendar'[WeekNum] ) - 1
        )
    )
RETURN
    DIVIDE ( SUM ( Value Sum ) - lastWeekAmount, lastWeekAmount, 0 )

 

 

Regards,

Gaurav  Raj Singh

 

LinkedIN : https://www.linkedin.com/in/gauravrajsingh/

 

 

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

Hi @Anonymous ,

 

Please use the below formula 

 

Measure =
VAR lastWeekAmount =
    CALCULATE (
        SUM ( Value Sum),
        FILTER (
            ALL ( 'Calendar' ),
            'Calendar'[WeekNum]
                = MIN ( 'Calendar'[WeekNum] ) - 1
        )
    )
RETURN
    DIVIDE ( SUM ( Value Sum ) - lastWeekAmount, lastWeekAmount, 0 )

 

 

Regards,

Gaurav  Raj Singh

 

LinkedIN : https://www.linkedin.com/in/gauravrajsingh/

 

 

Anonymous
Not applicable

Thank you very much for your help^^

 

 

 

Anonymous
Not applicable

@Anonymous 

 

it worked ?

Anonymous
Not applicable

Yes it worked^^ Thanks you

 

By the way, i need to show Week sales as following

 

In this case i need to calculate This week sale and last week sale.

 

would you help me Dax for those?

 

Thank you very much again.

 

이미지 4.png

Anonymous
Not applicable

Hi @Anonymous ,

 

Try this for LastweekSales

LastWeekSales = 

Var ThisWeek = Max(WeekNum)

Return

calculate(sum(sales),WeekNum = ThisWeek - 1)

 

Regards,

Gaurav

Anonymous
Not applicable

It worked perfect^^😊😊😊😊

 

How about week to date /This week sale/??

 

Thank you, thank you...

 

Anonymous
Not applicable

@Anonymous 

 

 

Try this :

ThisWeekToDate = 

calculate(sum(sales),WeekNum = MAX(WeekNum))

 

 

Anonymous
Not applicable

이미지 5.png

 

 

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.