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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Removing an outlier from daily revenue to create average daily revenue over 30 days

I have a table that totals our daily revenue with a date. I use the following formula to give me a avg daily revenue over 30 days.

However because February only has 28 days, the last day in February included the payments for what would be the 29th, 30th and 31st of normal months, essentially we got up to 4 days of payments into one so it is artificailly making the average higher than it should be. Is there an easy way to solve this problem? Thanks in advance! 

date_actualSum of Total
20-Feb-22$31,788.02
21-Feb-22$33,750.21
22-Feb-22$31,569.05
23-Feb-22$32,070.29
24-Feb-22$34,994.32
25-Feb-22$35,119.62
26-Feb-22$33,230.44
27-Feb-22$36,018.30
28-Feb-22$96,210.87
1-Mar-22$25,788.40


 
 
1 ACCEPTED SOLUTION
negi007
Community Champion
Community Champion

@Anonymous you can create a new measure like below

 

New_Total =

var YearStartDate = DATE('Table'[date_actual].[Year],1,1)
var YearEndDate = DATE('Table'[date_actual].[Year],12,31)
var TotalDays = (YearEndDate - YearStartDate) + 1
var IsLeapYear = IF(TotalDays = 366,"Yes","No")
return
if ( and (TotalDays=365,'Table'[date_actual].[Date]=DATE(year(YearStartDate),2,28)),'Table'[Sum of Total]/3,
if ( and(TotalDays=366,'Table'[date_actual].[Date]=DATE(Year(YearStartDate),2,29)),'Table'[Sum of Total]/2,
'Table'[Sum of Total]))
 
negi007_0-1646234428970.png

let me know if this method helps you. You can customize your average formula as well 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

View solution in original post

4 REPLIES 4
negi007
Community Champion
Community Champion

@Anonymous you can create a new measure like below

 

New_Total =

var YearStartDate = DATE('Table'[date_actual].[Year],1,1)
var YearEndDate = DATE('Table'[date_actual].[Year],12,31)
var TotalDays = (YearEndDate - YearStartDate) + 1
var IsLeapYear = IF(TotalDays = 366,"Yes","No")
return
if ( and (TotalDays=365,'Table'[date_actual].[Date]=DATE(year(YearStartDate),2,28)),'Table'[Sum of Total]/3,
if ( and(TotalDays=366,'Table'[date_actual].[Date]=DATE(Year(YearStartDate),2,29)),'Table'[Sum of Total]/2,
'Table'[Sum of Total]))
 
negi007_0-1646234428970.png

let me know if this method helps you. You can customize your average formula as well 




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

Anonymous
Not applicable

This worked liked a charm, thank you! 

amitchandak
Super User
Super User

@Anonymous , you can check and divide

example

if(day(eomonth(max(date[Date]),0)) in {28,29} , [Sum of Total]/4, [Sum of Total])

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Thank you for that. Im still a little confused but what is the best way to incorporate it. Here is my formula.

 
Avg Daily Revenue Over 30 Days = CALCULATE (
SUM (dim_date[amount]),
DATESINPERIOD( dim_date[date_actual], TODAY() -1, -30, DAY )
) / 30

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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