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

Calculating a mean/average based on a measure

Hello guys,

I have the following measure which counts the number of occurrences of product IDs within a column.

 

Occurrence = COUNT('Table'[Product ID])

 

Since I would like to find out how often product IDs recur on average within the column "Product ID", is there a way to calculate a mean/average based on the above measure?

Hope you can help 🙂

 

6 REPLIES 6
Anonymous
Not applicable

Hi @Anonymous ,

Did I answer your question? Please mark my reply as solution, thank you~

 

Best Regards,

Eyelyn Qin

Anonymous
Not applicable

Hi @Anonymous ,

According to my understanding, you want to calculate frequency of each ProductID based on a measure—“Occurrence, right?

 

You could use the following formula:

Occurrence =
CALCULATE (
    COUNT ( 'Table'[ProductID] ),
    ALLEXCEPT ( 'Table', 'Table'[ProductID] )
)
AVG =
[Occurrence] / CALCULATE ( COUNTROWS ( 'Table' ), ALL ( 'Table' ) )

My visualization looks like this:

8.25.2.1.png

Is the result what you want? If you have any questions, please upload some data samples and expected output.

Please do mask sensitive data before uploading.

 

Best Regards,

Eyelyn Qin

amitchandak
Super User
Super User

@Anonymous , Try a new measure like

Avg Occurence = averagex(summarize('Table'[Product ID],"_1", COUNT('Table'[Product ID])),[_1])

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

Hi @Anonymous 

I believe what you are looking for is if 

Product ID
A
B
A

Then you need the output as 

product IDOccurrence 
A.66    or 66%
B.33    or 33%

 

 

 

Occurrence = count('Table'[Product ID])/CALCULATE(COUNTROWS('Table'),ALLSELECTED('Table'))

 

 

 IF you need it in percentage convert the measure to %

pranit828_0-1598330993177.png

 

 

Greg_Deckler
Community Champion
Community Champion

@Anonymous - 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...
mahoneypat
Microsoft Employee
Microsoft Employee

Please try this expression in a measure

 

Avg Occurence = AVERAGEX(VALUES('Table'[Product ID]), [Occurence])

 

If this works for you, please mark it as the solution.  Kudos are appreciated too.  Please let me know if not.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


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