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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
AllanBerces
Post Prodigy
Post Prodigy

Max Count

Hi good day can someone help me on my maeasure, on my table with column Date, BP's, laborType. i want to get the highest count of Labortype on what date.

From my table 

AllanBerces_0-1757060770735.png

DESIRED RESULT OF MEASURE - Only the Date with the highest count

AllanBerces_1-1757060890961.png

Thank you

1 ACCEPTED SOLUTION
danextian
Super User
Super User

Hi @AllanBerces .

 

Create a virtual summarized table of each date and the value. Pick the one with the highest value using TopN and use that top date as a filter

Max Value Date =
VAR TopDate =
    CALCULATE (
        MAXX (
            TOPN (
                1,
                ADDCOLUMNS (
                    SUMMARIZE ( ALLSELECTED ( Dates ), Dates[Date] ),
                    "@value", [Total Transactions] -- or your count measure
                ),
                [@value], DESC
            ),
            [Date]
        ),
        ALLSELECTED ()
    )
RETURN
    CALCULATE ( [Total Transactions], KEEPFILTERS ( Dates[Date] = TopDate ) )

danextian_0-1757075926957.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

View solution in original post

11 REPLIES 11
danextian
Super User
Super User

Hi @AllanBerces .

 

Create a virtual summarized table of each date and the value. Pick the one with the highest value using TopN and use that top date as a filter

Max Value Date =
VAR TopDate =
    CALCULATE (
        MAXX (
            TOPN (
                1,
                ADDCOLUMNS (
                    SUMMARIZE ( ALLSELECTED ( Dates ), Dates[Date] ),
                    "@value", [Total Transactions] -- or your count measure
                ),
                [@value], DESC
            ),
            [Date]
        ),
        ALLSELECTED ()
    )
RETURN
    CALCULATE ( [Total Transactions], KEEPFILTERS ( Dates[Date] = TopDate ) )

danextian_0-1757075926957.png

 

 





Dane Belarmino | Microsoft MVP | Proud to be a Super User!

Did I answer your question? Mark my post as a solution!


"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi @danextian @Shahid12523 @rohit1991 thank you very much for the reply working as i need

AllanBerces
Post Prodigy
Post Prodigy

Hi @jaineshp thank you very much for the reply but it show error

AllanBerces_0-1757068352556.png

thank you

Hello @AllanBerces,

The comment you were responding to has been removed. 

 

Best,

Natalie H.

Community Manager 

rohit1991
Super User
Super User

Hi @AllanBerces 

You can achieve this directly using a Top N filter on the Matrix visual.

 

Steps:

Create a simple measure for your counts:

Total Count =
SUM ( Fact[Qty] )

 

Build your Matrix:

  • Rows >> DPR_DATE >> LaborType
  • Values >> [Total Count]

In the Filters on this visual pane:

  • Drag DPR_DATE into the filters.
  • Change the filter type to Top N.
  • Set Show items = Top 1.
  • By value >> drop [Total Count].
  • Click Apply filter.

Result:

The Matrix now shows only the date that has the highest total count (in your case, 2 June 2025 = 234) along with the LaborType breakdown underneath.


image.png

 


Did it work? ✔ Give a Kudo • Mark as Solution – help others too!

Hi @rohit1991 thank you very much for the reply but i cant used that way, i will add this measure to other table

Shahid12523
Community Champion
Community Champion

MaxLaborTypeDate =
CALCULATE (
MAX ( 'YourTable'[Date] ),
TOPN (
1,
SUMMARIZE ( 'YourTable', 'YourTable'[Date], "Count", COUNTROWS ( 'YourTable' ) ),
[Count], DESC
)
)

Shahed Shaikh

Hi @Shahid12523 thank you very much for the reply but data show on the measure

jaineshp
Memorable Member
Memorable Member

Hey @AllanBerces,

You can try using this measure:

Max Count =
VAR MaxCountInTable =
CALCULATE(
MAX([Count]),
ALLSELECTED()
)
RETURN
IF(
[Count] = MaxCountInTable,
[Count],
BLANK()
)

 

Fixed? ✓ Mark it • Share it • Help others!


Best Regards,
Jainesh Poojara | Power BI Developer

Hi @jaineshp thank you very much for the reply but i dont know where can i get the count you used on the measure. I try to used the measure i created but show error

AllanBerces_0-1757062922169.png

 

My Measure on count

Trade Count = COUNT('Table01'[Labor Type])
 
Thank you

Hi,

Share some data to work with and show the expected result.  Share data in a format that can be pasted in an MS Excel file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.