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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

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

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
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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