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
PrieleBI
Frequent Visitor

Average of datediff measure

Hello,

 

How to calculate average of dateiff measure? (see the picture below)

In this case measure calculates time between firs IN and last OUT (373,5) and it is wrong -  I need the average of it

(51+71+45+56+51)/ 5 = 54,8

 

1 row = 1 route ID

 

PrieleBI_0-1730219081205.png

 

2 REPLIES 2
Anonymous
Not applicable

Thank you Greg_Deckler 

Hi, @PrieleBI 

What you are showing is usually when you use some complex calculations in your measure, which causes the Total row to be displayed incorrectly. This is normal behavior. The external filter-row label is lost in the Total row. We need to manually fix this error and specify the calculation logic corresponding to the Total row.

vjianpengmsft_0-1730271115956.png

The isinscope function is mainly used here:

Measure = 
IF(ISINSCOPE('Table'[IN]),[TIME S],AVERAGEX(VALUES('Table'[IN]),[TIME S]))

vjianpengmsft_1-1730271178684.png

When we change the time range, the Total row will be calculated according to the calculation logic we specified and the correct result will be obtained.

vjianpengmsft_2-1730271222703.png

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Greg_Deckler
Community Champion
Community Champion

@PrieleBI This looks like a measure aggregation problem. See my blog article about that here: https://community.powerbi.com/t5/Community-Blog/Design-Pattern-Groups-and-Super-Groups/ba-p/138149

The pattern is:
MinScoreMeasure = MINX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
MaxScoreMeasure = MAXX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
AvgScoreMeasure = AVERAGEX ( SUMMARIZE ( Table, Table[Group] , "Measure",[YourMeasure] ), [Measure])
etc.



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
Top Kudoed Authors