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
Anonymous
Not applicable

Measure not working, when calculated column worked. Using Average.

I have a table with the columns "Value", "Analyte", "Color", "AnalyteType" and "DateEnter". I created a calculated column that averages by all those groups and takes only the last 12 months of data. I would like to move this to a measure though, so I can change which data is used on the fly.

 

ValueAnalyteColorAnalyteTypeDateEnter
5.44BalloonBlueLab2022/05/04
62.5CarRedLab2022/03/11
11.5CarPurpleOutside2022/02/08
78.1ChairBlueIndoor2022/04/22

 

Here is the calculated column that works:

 

Column1 = calculate(average(Main[Value]),filter(Main,Main[Analyte]=EARLIER(Main[Analyte])),filter(Main,Main[Color]=EARLIER(Main[Color])),filter(Main,Main[AnalyteType]="Lab"),filter(Main,Main[DateEnter]>today()-365))

 

Here is the measure I tried:

 

MeasureDiffs =
average(calculate(average(Main[Final]),filter(Main,Main[Analyte]=EARLIER(Main[Analyte])),filter(Main,Main[Color]=EARLIER(Main[Color])),filter(Main,Main[AnalyteType]="Lab")))
 
I get the error "The AVERAGE function only accepts a column reference as an argument". I don't understand because it did work as a column in the data table. Any ideas?
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try like

 

calculate(average(Main[Final]),filter(allselected(Main),Main[Analyte]=Max(Main[Analyte]) &&  Main[Color]=Max (Main[Color]) && Main[AnalyteType]="Lab"))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try like

 

calculate(average(Main[Final]),filter(allselected(Main),Main[Analyte]=Max(Main[Analyte]) &&  Main[Color]=Max (Main[Color]) && Main[AnalyteType]="Lab"))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

That worked great. Why use the "Max" instead of "Earlier"?

Helpful resources

Announcements
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!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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