cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
nagoor Regular Visitor
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

 

Sample file 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Percentage Deviations hour to hour

Hi @nagoor ,

Please try the following formula.

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))

2.PNG 

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.

View solution in original post

2 REPLIES 2
Community Support Team
Community Support Team

Re: Percentage Deviations hour to hour

Hi @nagoor ,

Please try the following formula.

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))

2.PNG 

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.

View solution in original post

nagoor Regular Visitor
Regular Visitor

Re: Percentage Deviations hour to hour

Hi @v-xuding-msft

 

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? 

 

Thanks in advance, 

Meeran

Helpful resources

Announcements
New Kudos Received Badges Coming

New Kudos Received Badges Coming

Kudos to you if you earned one of these! Check your inbox for a notification.

Microsoft Implementation for Communities Wins Award

Microsoft Implementation for Communities Wins Award

Learn about the award-winning innovation that was implemented across Microsoft’s Business Applications Communities.

Power Platform World Tour

Power Platform World Tour

Find out where you can attend!

Top Kudoed Authors (Last 30 Days)
Users online (3,282)