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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
tbobolz
Resolver I
Resolver I

Calculate values allexcept the first value of each unique date formula help.

Hello all, I'm struggling with calculating an average of values, but needing it to ignore the very first value of each day as it is always zero. 

 

I'm averaging a total "Patient_Turnover_Time" field which list whole number values in minutes for each surgery performed. This is years’ worth of data; however, the first surgery of each day is always zero since theirs no previous surgery is preformed, so I need to ignore the first surgery of each day ("Scheduled_Start" Format example: 11/9/2018 9:00:00 AM) in this average.    

 

I have this average in a card visual. but the user could update the dashboard with filters.

 

I was playing around with this, but I can't seem to complete it:  

Average Turnover = CALCULATE(AVERAGE([PATIENT_TURNOVER_TIME]), ALLEXCEPT(Earliest(

 

Any help or suggestions would be appreciated.

 

Terry

1 ACCEPTED SOLUTION
Greg_Deckler
Community Champion
Community Champion

@tbobolz Maybe:

Average Measure =
  VAR __Table = 'Table'
  VAR __IgnoreTable = SELECTCOLUMNS(SUMMARIZE('Table',[Date],"__Min",MIN([Scheduled_Start])),"__Scheduled_Start",[__Min])
  VAR __AverageTable = FILTER(__Table,NOT([Scheduled_Start] IN __IgnoreTable))
RETURN
  AVERAGEX(__AverageTable,[Patient_Turnover_Time])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

3 REPLIES 3
Greg_Deckler
Community Champion
Community Champion

@tbobolz Maybe:

Average Measure =
  VAR __Table = 'Table'
  VAR __IgnoreTable = SELECTCOLUMNS(SUMMARIZE('Table',[Date],"__Min",MIN([Scheduled_Start])),"__Scheduled_Start",[__Min])
  VAR __AverageTable = FILTER(__Table,NOT([Scheduled_Start] IN __IgnoreTable))
RETURN
  AVERAGEX(__AverageTable,[Patient_Turnover_Time])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

@Greg_Deckler 

 

Thankyou very much, you are a genius!

 

Below is my formula with inserted fields; however, how would I add the condition to ingore that first scheduled surgery as you have written it, but only if it is equal to zero? 

 

Average Turnover =
VAR __Table = 'OR Turnover'
VAR __IgnoreTable = SELECTCOLUMNS(SUMMARIZE('OR Turnover',[SCHEDULED_START].[Date],"__Min",MIN([Scheduled_Start])),"__[Scheduled_Start]",[__Min])
VAR __AverageTable = FILTER(__Table,NOT([Scheduled_Start] IN __IgnoreTable))
RETURN
AVERAGEX(__AverageTable,[Patient_Turnover_Time])

 

@tbobolz Try:

Average Turnover =
VAR __Table = 'OR Turnover'
VAR __IgnoreTable = SELECTCOLUMNS(SUMMARIZE(FILTER('OR Turnover',[Patient_Turnover_Time]=0),[SCHEDULED_START].[Date],"__Min",MIN([Scheduled_Start])),"__[Scheduled_Start]",[__Min])
VAR __AverageTable = FILTER(__Table,NOT([Scheduled_Start] IN __IgnoreTable))
RETURN
AVERAGEX(__AverageTable,[Patient_Turnover_Time])


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors