cancel
Showing results for
Did you mean:
Highlighted
nagoor Regular Visitor

## Percentage Deviations hour to hour

Dear Experts,

I have an excel data for each hour sales against the products, I want to compare the sales deviations compared to last week on the same day and today.

Ex: Today(14-11) with Thursday(07-11)

Usually, I do it excel in the below way.

1) Pivot the raw data.

2) select the today and Thursday

3) Then copy and paste it in another sheet

4) And then do the formula (Today-Thursday/Thursday)*100

I have attached the sample file, could someone suggest the best possible way to do it in Power Bi.

Thanks

Meeran

1 ACCEPTED SOLUTION

Accepted Solutions Community Support Team

## Re: Percentage Deviations hour to hour

Hi @nagoor ,

``````Percentage Deviations =
var Today = CALCULATE(SUM('Table'[Total item sale]),FILTER('Table','Table'[Date] = TODAY()))
var Last_Week = CALCULATE(SUM('Table'[Total item sale]),FILTER('Table','Table'[Date] = TODAY()-7))
return
IF(Today = BLANK(),BLANK(),DIVIDE(Today- Last_Week,Last_Week))`````` The formula above is a little different between what in my sample. Because there is no data which on 11/15/2019. You could reference the sample but use the formula above. Hope it will help you.

Best Regards,

Xue Ding

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

2 REPLIES 2 Community Support Team

## Re: Percentage Deviations hour to hour

Hi @nagoor ,

``````Percentage Deviations =
var Today = CALCULATE(SUM('Table'[Total item sale]),FILTER('Table','Table'[Date] = TODAY()))
var Last_Week = CALCULATE(SUM('Table'[Total item sale]),FILTER('Table','Table'[Date] = TODAY()-7))
return
IF(Today = BLANK(),BLANK(),DIVIDE(Today- Last_Week,Last_Week))`````` The formula above is a little different between what in my sample. Because there is no data which on 11/15/2019. You could reference the sample but use the formula above. Hope it will help you.

Best Regards,

Xue Ding

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

nagoor Regular Visitor

## Re: Percentage Deviations hour to hour

Thanks a lot for your help, it really worked out. I have another doubt.

Is that possible to select the date range dynamically, which means not only the selected -1 & -8 days if we want to compare the trend for -2 & -10 also by selecting in the date field if it gives the deviation percentage it would help us better?

Meeran

Announcements   