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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
abbas_uddin
Helper I
Helper I

Max Date or last based on specific column

Hi Experts,

 

Since i am new to Power BI, need help on the subject. The scenario is i am pulling a data set and what i want to achieve is the max or last of date based on specific column.

 

i have customers and their sub category by invoice date. i want the list of customer by applying max / last of invoice date regardless of what category it was, it should show me the last row or max row. see the example below:

 

Raw Data:

CompanyCustomerCustomer CategoryCustomer Category 2Invoice Date
XYYAB-1RetailWS COMBO01-Feb-19
XYYAB-1Domestic othersWS COMBO26-Feb-19
XYYDC-2RetailKA- SUPERMARKET13-Jan-19
XYYDC-2Domestic othersKA- SUPERMARKET

31-Jan-19

 

Final result should be below:

 

CompanyCustomerCustomer CategoryCustomer Category 2Invoice Date
XYYAB-1Domestic othersWS COMBO26-Feb-19
XYYDC-2Domestic othersKA- SUPERMARKET31-Jan-19

 

So the last date of customer AB-1 and DC-2 is 26 Feb and 31 Jan respectively. They had different category regardless of that it should show the last invoice date happened on customer level not the category level.

 

kindly let me know how it can be achieved, even if it creates a new table from existing table also im fine with it.

 

Regards

1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @abbas_uddin ,

 

You need to calculate the max date and compare dates with it. Then use a flag ( a measure )to filter your data.

Measure =
VAR a =
    CALCULATE (
        MAX ( 'Table'[Invoice Date] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer] )
    )
RETURN
    IF ( a = SELECTEDVALUE ( 'Table'[Invoice Date] ), 1, 0 )

Now you could set the rule in the filter pane to show data whose measure is 1.

3-1.PNG

Here is my test file for your reference.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

2 REPLIES 2
v-eachen-msft
Community Support
Community Support

Hi @abbas_uddin ,

 

You need to calculate the max date and compare dates with it. Then use a flag ( a measure )to filter your data.

Measure =
VAR a =
    CALCULATE (
        MAX ( 'Table'[Invoice Date] ),
        ALLEXCEPT ( 'Table', 'Table'[Customer] )
    )
RETURN
    IF ( a = SELECTEDVALUE ( 'Table'[Invoice Date] ), 1, 0 )

Now you could set the rule in the filter pane to show data whose measure is 1.

3-1.PNG

Here is my test file for your reference.

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
amitchandak
Super User
Super User

Refer, if this can help

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. My Recent Blog -
https://community.powerbi.com/t5/Community-Blog/Winner-Topper-on-Map-How-to-Color-States-on-a-Map-wi...
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
https://community.powerbi.com/t5/Community-Blog/Power-BI-Working-with-Non-Standard-Time-Periods/ba-p...
https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

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

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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