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
AaronToth
Resolver I
Resolver I

Measure that displays the number of times the most frequent value of a column appeared

I am looking for a way to create a measure that returns this numerical value and does not need the creation of an additional table and/or column.

 

Example:  In a 1 column table with the heading "colour" you see.

Red

Red

Blue

Green

Blue

Red

 

Red has the most occurrences at 3.  I want the measure to return 3, not "Red".  I've tried TOPN, MAX, MAXX, GROUPBY and some others.  It seems like the solutions are to create a new table and/or a new column and then look at that.  This seems a bit much to get this value.  How is this done without the use of another table or column?

1 ACCEPTED SOLUTION

@AaronToth Seems like MODE: Mode - Single Column - Microsoft Power BI Community

In your case:

Mode = VAR myTable = SUMMARIZE(Table,Table[Column],"Count",COUNT(Table[Column]))
VAR myTable2 = FILTER(myTable,[Count]=MAXX(myTable,[Count]))
VAR Mode1 = MAXX(LASTNONBLANK(myTable2,[Column]),[Column])
RETURN
COUNTROWS(FILTER(Table,[Column]=Mode1))


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...

View solution in original post

3 REPLIES 3
AaronToth
Resolver I
Resolver I

I really appreciate the quick help @Greg_Deckler .  It worked flawlessly.  I guess the easier way of asking this question was to seek help finding the 'mode'.  Thanks again! 

AaronToth
Resolver I
Resolver I

With the use of TOPN I am able to get the value in the column that appears most, not the number of times it appeared.  It looks like there are some issues with ties when using some of these approaches, but that is okay in my use case.  I am not looking for "RED", "BLUE" or "GREEN" where a tie would matter in cases (i.e. blue and green both 2).  

Since I am looking at the number of times (most occurrences), then a 2 is a 2.  This is why I feel there should be a combination of two/three built in functions to return this value.

 

@AaronToth Seems like MODE: Mode - Single Column - Microsoft Power BI Community

In your case:

Mode = VAR myTable = SUMMARIZE(Table,Table[Column],"Count",COUNT(Table[Column]))
VAR myTable2 = FILTER(myTable,[Count]=MAXX(myTable,[Count]))
VAR Mode1 = MAXX(LASTNONBLANK(myTable2,[Column]),[Column])
RETURN
COUNTROWS(FILTER(Table,[Column]=Mode1))


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...

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.