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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jaydesai28
Frequent Visitor

DAX formula for calculating average for particular category is not working

I made one measure for calcualting average execution time per report but it does not work.

 

AverageExecutionTime = CALCULATE(AVERAGE(ReportFields[TotalTime]),ALLEXCEPT(ReportFields,ReportFields[ReportName]))

Capture2.PNG

I am using  Direct Query mode.

1 ACCEPTED SOLUTION

I'm not 100% sure what your looking for but if I create a calculated column using:

 

AverageExecutionTime = CALCULATE(AVERAGEA(Sheet1[TotalTime]),ALLEXCEPT(Sheet1, Sheet1[ReportName]))

 

I get:

ReportTest.PNG

 

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@jaydesai28

 

You look close. You might want to try swapping out the ALLEXCEPT for ALLSELECTED.

 

AverageExecutionTime = CALCULATE(AVERAGE(ReportFields[TotalTime]),ALLSELECTED(ReportFields[ReportName]))

 

Hope this helps,

Parker

Capture3.PNG

It does not wotk either.

Anonymous
Not applicable

Try this:

 

AverageExecutionTime = 
VAR CurrentReport = FIRSTNONBLANK(ReportFields[ReportName]),1)
RETURN
CALCULATE(
AVERAGE(ReportFields[TotalTime]),
FILTER(
ALL(ReportFields),
ReportFields[ReportName] = CurrentReport
)
)



 

I'm not 100% sure what your looking for but if I create a calculated column using:

 

AverageExecutionTime = CALCULATE(AVERAGEA(Sheet1[TotalTime]),ALLEXCEPT(Sheet1, Sheet1[ReportName]))

 

I get:

ReportTest.PNG

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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