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
Anonymous
Not applicable

Max value with date

Hi,

 

I need to get the max value in a category with its corresponding date (preferably in DAX).

 

the example as follow

 

Table1
CityValueDate
RIY1010/9/2019
RIY2510/10/2019
RIY1110/11/2019
MKK810/10/2019
MKK910/9/2019

 

The result should be like this

 

Result
CityValueDate
RIY2510/10/2019
MKK910/9/2019

 

Thank You in advance for your help

1 ACCEPTED SOLUTION

Thought it would be worth mentioning that the first answer will still have all the original values with an extra column identifying the highest for a product type without further work. I'm adding this in case a new table is wanted that only has those highest values and not the whole original table.

First, add a calculated column to your table that creates the rank per city.

Rank ColumnRank Column

Rank = 
RANKX (
    FILTER(
    'Table',
    'Table'[City] = EARLIER('Table'[City])
    ),
    'Table'[Value],
    ,
    DESC,
    DENSE
)


Now create a new table that selects only each city entry that was ranked 1.


New table that only has cities that were ranked 1New table that only has cities that were ranked 1

Table2 = 
SELECTCOLUMNS(
    FILTER( 'Table', 'Table'[Rank] = 1),
    "City", 'Table'[City],
    "Value", 'Table'[Value],
    "Date", 'Table'[Date]
)

When you create your table visual now from the values on the new table you will only have the ranked 1st entries.
ComparsionComparsion

View solution in original post

3 REPLIES 3
amitchandak
Super User
Super User

Please try

https://community.powerbi.com/t5/Desktop/highest-value-by-category/td-p/428758

 

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution. In case it does not help, please provide additional information and mark me with @
Thanks.

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

Thought it would be worth mentioning that the first answer will still have all the original values with an extra column identifying the highest for a product type without further work. I'm adding this in case a new table is wanted that only has those highest values and not the whole original table.

First, add a calculated column to your table that creates the rank per city.

Rank ColumnRank Column

Rank = 
RANKX (
    FILTER(
    'Table',
    'Table'[City] = EARLIER('Table'[City])
    ),
    'Table'[Value],
    ,
    DESC,
    DENSE
)


Now create a new table that selects only each city entry that was ranked 1.


New table that only has cities that were ranked 1New table that only has cities that were ranked 1

Table2 = 
SELECTCOLUMNS(
    FILTER( 'Table', 'Table'[Rank] = 1),
    "City", 'Table'[City],
    "Value", 'Table'[Value],
    "Date", 'Table'[Date]
)

When you create your table visual now from the values on the new table you will only have the ranked 1st entries.
ComparsionComparsion

Anonymous
Not applicable

Thank you so much, it did the trick for me.

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.