Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
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
Solved! Go to Solution.
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))
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.
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))
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.
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
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |