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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Yvalson
Frequent Visitor

Get average from a measure in datamodel

Hi All,

 

I'm currently working with a datamodel that was created by our BI partner.

This model has  a measure called "Margin" that calculates the margin on orders/products etc.. based on relations in the datamodel.

I want to make a measure that gets the average margin in a period. For example I have a page where I can select a week and it will show information about that week.

The "AVERAGE" function in PBI needs to refer to a table which I don't have. Is it possible to still get the average margin or is this not possible in PBI?

 

Measure would look something like this:

 

Avg_Margin = AVERAGE(Margin)

 

Thanks in advance!

1 ACCEPTED SOLUTION
Anonymous
Not applicable

HI @Yvalson,

How did these two table relationship mapping? Can you please share some more detail infoatmaiosn about these? They will help us clarify your caeiro and test to coding formulas.

How to Get Your Question Answered Quickly  

BTW, measure expression cannot directly aggregate with other functions. You can create a variable table with this formula to stay the specific result based on current category group.

Then you can use iterator aggregate function to apply the second level aggregation on it.

formula =
VAR selection =
    ALLSELECTED ( Calendar[Date] )
VAR summary =
    SUMMARIZE (
        FILTER ( ALLSELECTED ( Table1 ), [Date] IN selection ),
        [Date],
        "cMargin", [Margin]
    )
RETURN
    AVERAGEX ( summary, [cMargin] )

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

HI @Yvalson,

How did these two table relationship mapping? Can you please share some more detail infoatmaiosn about these? They will help us clarify your caeiro and test to coding formulas.

How to Get Your Question Answered Quickly  

BTW, measure expression cannot directly aggregate with other functions. You can create a variable table with this formula to stay the specific result based on current category group.

Then you can use iterator aggregate function to apply the second level aggregation on it.

formula =
VAR selection =
    ALLSELECTED ( Calendar[Date] )
VAR summary =
    SUMMARIZE (
        FILTER ( ALLSELECTED ( Table1 ), [Date] IN selection ),
        [Date],
        "cMargin", [Margin]
    )
RETURN
    AVERAGEX ( summary, [cMargin] )

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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