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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
FOXYBARK
Helper III
Helper III

How to structure a count of daily maximum count (Yes, count of a count)

Hi PBI users. 

I am attaching a sample doc that lays out exactly what I'm looking for. I'm fairly new to PBI. In my example, I would like to have a count of the daily maximum count. How many times was that daily maximum hit?I would like this either as a histogram as shown in my example of even a standalone measure. I'm good with either.  Oh and the catch is the final output needs to be dynamic since we are using slicers. For example, a HR Dept or Building Name slicer. 

This is a snip of sample badge data. 

 

Badge #Hr DeptBadge DateBuilding Name
19ABC04/15/2022EDISON
19ABC04/16/2022CARNIGIE
19ABC04/17/2022EDISON
19ABC04/18/2022CARNIGIE
19ABC04/19/2022EDISON
19ABC04/20/2022CARNIGIE
19ABC05/31/2022EDISON
19ABC04/22/2022CARNIGIE
19ABC04/23/2022EDISON
19ABC04/24/2022CARNIGIE
23ABC04/15/2022EDISON
17ABC04/18/2022CARNIGIE
74ABC04/15/2022EDISON
23ABC04/18/2022CARNIGIE
23ABC04/19/2022EDISON
23ABC04/20/2022CARNIGIE
23ABC04/21/2022EDISON
23ABC05/15/2022EDISON

 

The desired output

FOXYBARK_0-1652908308323.png

 

Any thoughts on this would be great. I appreciate any assistance. My raw data is a table. 

1 ACCEPTED SOLUTION
FOXYBARK
Helper III
Helper III

Step 1: In Power Query window, use Group by to group table by table[BadgeDate] with a count. 

FOXYBARK_0-1654697552858.png

 

Step 2: Create the following measures in the data pane. 

maxcnt = MAX(Data[Count])
cntFinal = COUNT(Data[Final])
Modex = MINX (TOPN (1,ADDCOLUMNS (VALUES ( Table[Badge Date] ),"Frequency", CALCULATE ( COUNT(Table[Badge Date]))),[Frequency],0), Table[Badge Date])
Final = CALCULATE([Modex], Table[Count]=Table[maxcnt])
 
This set of measures/columns will count how many times the count matches the max count. (Count of a count) CntFinal is the metric you will put on a card for users. 

View solution in original post

8 REPLIES 8
FOXYBARK
Helper III
Helper III

Step 1: In Power Query window, use Group by to group table by table[BadgeDate] with a count. 

FOXYBARK_0-1654697552858.png

 

Step 2: Create the following measures in the data pane. 

maxcnt = MAX(Data[Count])
cntFinal = COUNT(Data[Final])
Modex = MINX (TOPN (1,ADDCOLUMNS (VALUES ( Table[Badge Date] ),"Frequency", CALCULATE ( COUNT(Table[Badge Date]))),[Frequency],0), Table[Badge Date])
Final = CALCULATE([Modex], Table[Count]=Table[maxcnt])
 
This set of measures/columns will count how many times the count matches the max count. (Count of a count) CntFinal is the metric you will put on a card for users. 
v-luwang-msft
Community Support
Community Support

Hi @FOXYBARK ,

Has your problem been solved, if so, please consider Accept a correct reply as the solution or share your own solution to help others find it.

Best Regards
Lucien

Anonymous
Not applicable

Ok no prebs.

Please create a new measure that you can put on a card

maxbadge =
VAR _step1 =
ADDCOLUMNS (
SUMMARIZE ( badge, badge[Badge Date] ),
"Nbr pass", CALCULATE ( COUNT ( badge[Badge Date] ) )
)
VAR result =
MAXX ( _step1, [Nbr pass] )
RETURN
result
JamesFr06_0-1652990263050.pngJamesFr06_1-1652990287247.png

 

Yes, we are getting closer. In your left most graph, the answer on the card should be '1' and in your rightmost graph, the answer on the card should be '2'. See where I'm going with it? 

 

Anonymous
Not applicable

,


Something like this

JamesFr06_0-1652909353392.png

I just create this measure ==> 

nb badge = count(badge[Badge Date])
 
and after building graph and table

Thank you. I have the measure intact. However, how do I get it to show the histogram such that you have? Or even a standalone measure. Should I do a max(count(badge[Badge Date])? 

Anonymous
Not applicable

like this

JamesFr06_0-1652974502446.png

and for slicers

JamesFr06_1-1652974600514.png

 

Thank you again. I have to apologize as I'm not being clear about my ask. But we're on the right track.  In this example, the count of '3' was reached 2x. I want that number '2' to be the metric I'm displaying. How many times was the daily maximum of '3' hit? Again, my apologies for not being clear. Thank you for your help. 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors