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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
jcastr02
Post Prodigy
Post Prodigy

Average on or after a specific date

I have a file with store closing dates and daily sales....

I'd like to be able to see the average of the Daily Sales column only for data ON or AFTER the closure date.  Example for store 123, the Average of those 6 Dates is ~297, but for those 5 dates after 1/2/2025, the average is 305 =  (257+300+301+333+332)/ 5

Is there a measure that can do this?

See below sample data

DateStr NumberDaily SalesClosure DateAvg After Closing Date
1/1/20251232561/2/2025 
1/2/20251232571/2/2025305
1/3/20251233001/2/2025 
1/4/20251233011/2/2025 
1/5/20251233331/2/2025 
1/6/20251233321/2/2025 
1/1/20254561001/3/2025 
1/2/20254561011/3/2025 
1/3/20254561251/3/2025113
1/4/20254561101/3/2025 
1/5/20254561111/3/2025 
1/6/20254561051/3/2025 
1/1/20257895011/4/2025 
1/2/20257895251/4/2025 
1/3/20257895651/4/2025 
1/4/20257895251/4/2025529
1/5/20257895301/4/2025 
1/6/20257895311/4/2025 
1/1/20251017001/5/2025 
1/2/20251017051/5/2025 
1/3/20251017021/5/2025 
1/4/20251017011/5/2025 
1/5/20251016941/5/2025687
1/6/20251016801/5/2025 
1/1/20251021001/6/2025 
1/2/20251021081/6/2025 
1/3/20251021071/6/2025 
1/4/20251021061/6/2025 
1/5/20251021051/6/2025 
1/6/20251021151/6/2025115
2 ACCEPTED SOLUTIONS
DataInsights
Super User
Super User

@jcastr02,

 

Try this measure:

 

Avg After Closing Date = 
VAR vTable =
    CALCULATETABLE (
        SUMMARIZE ( 'Table', 'Table'[Str Number], 'Table'[Daily Sales] ),
        'Table'[Date] >= 'Table'[Closure Date]
    )
VAR vResult =
    AVERAGEX ( vTable, 'Table'[Daily Sales] )
RETURN
    vResult

 

DataInsights_0-1733169574813.png

 





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

Proud to be a Super User!




View solution in original post

@jcastr02,

 

Try adding an additional filter to exclude blank dates:

 

Avg After Closing Date =
VAR vTable =
    CALCULATETABLE (
        SUMMARIZE ( 'Table', 'Table'[Str Number], 'Table'[Daily Sales] ),
        'Table'[Date] >= 'Table'[Closure Date],
        NOT ISBLANK ( 'Table'[Closure Date] )
    )
VAR vResult =
    AVERAGEX ( vTable, 'Table'[Daily Sales] )
RETURN
    vResult

 





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

Proud to be a Super User!




View solution in original post

4 REPLIES 4
ThxAlot
Super User
Super User

ThxAlot_0-1733169799904.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



DataInsights
Super User
Super User

@jcastr02,

 

Try this measure:

 

Avg After Closing Date = 
VAR vTable =
    CALCULATETABLE (
        SUMMARIZE ( 'Table', 'Table'[Str Number], 'Table'[Daily Sales] ),
        'Table'[Date] >= 'Table'[Closure Date]
    )
VAR vResult =
    AVERAGEX ( vTable, 'Table'[Daily Sales] )
RETURN
    vResult

 

DataInsights_0-1733169574813.png

 





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

Proud to be a Super User!




Thank you @DataInsights 

Would you know also how to exclude dates where the Closure date field is blank.  It seems when there is no closing date listed its pulling those values in.  Thanks for your help. 

@jcastr02,

 

Try adding an additional filter to exclude blank dates:

 

Avg After Closing Date =
VAR vTable =
    CALCULATETABLE (
        SUMMARIZE ( 'Table', 'Table'[Str Number], 'Table'[Daily Sales] ),
        'Table'[Date] >= 'Table'[Closure Date],
        NOT ISBLANK ( 'Table'[Closure Date] )
    )
VAR vResult =
    AVERAGEX ( vTable, 'Table'[Daily Sales] )
RETURN
    vResult

 





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

Proud to be a Super User!




Helpful resources

Announcements
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 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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