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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
mbowler
Helper I
Helper I

Creating Average measures for table

I have a table of ticket sales for different events, each row is a seat. If the seat is still available the "Price" column is empty. I have created a couple of measures that give me the number of ticket sales and the total renevue that will then repond to the filter context I am currently using. However I wish to create an average #sales and average revenue per event for the context.

 

My measures are:

 

Total Sales = COUNT(AllSeatsData[Price])
Total Revenue = SUM(AllSeatsData[Price])

 

 

Here is some samples of my table:

DataSnippet 2.pngDataSnippet 1.png

 

 

 

 

 

 

 

 

 

 

Hence if my filter context has only the two above events in it, I am looking for measure that gives me the average of SUM([Price]) and one that gives me the average of COUNT([Price]). E.g. if the data above were the only rows in the table for these events, the average of #sales should be 9 (event 39001 has 6 sales, event 45201 has 12, average of 6 & 12 is 9).

 

I'm sure this is quite easy but I can't get my head around the maniputation of the context.

 

TIA.

1 ACCEPTED SOLUTION
AlexisOlson
Super User
Super User

First aggregate at the level you need for your business logic, then use AVERAGEX. If event is the granularity you want to average at, try this:

 

Event Avg Count =
VAR __Events =
    SUMMARIZE (
        AllSeatsData,
        AllSeatsData[Event Instance ID],
        "@Count", COUNTA ( AllSeatsData[Price] )
    )
RETURN
    AVERAGEX ( __Events, [@Count] )

View solution in original post

2 REPLIES 2
mbowler
Helper I
Helper I

Brilliant, that works great. Thanks @AlexisOlson !

AlexisOlson
Super User
Super User

First aggregate at the level you need for your business logic, then use AVERAGEX. If event is the granularity you want to average at, try this:

 

Event Avg Count =
VAR __Events =
    SUMMARIZE (
        AllSeatsData,
        AllSeatsData[Event Instance ID],
        "@Count", COUNTA ( AllSeatsData[Price] )
    )
RETURN
    AVERAGEX ( __Events, [@Count] )

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.