cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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 Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Solution Authors
Top Kudoed Authors (Last 30 Days)