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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
jwi1
Post Patron
Post Patron

show the most recent info

hi all,

 

I have the following question about below table. 

As you can see there are muliple rowes with the same container nr, but with different order dates ans status codes:

container_nrstatus_codorder_dat
SUDU516806411326-7-2018
SUDU516806411017-8-2018
SUDU51680641157-6-2018
SUDU51680641008-9-2017
APRU577333411012-10-2016
APRU577333411520-12-2016

 

I need a formula/ filter which gives me only the container number with the most recent order date.

So, the result of the formula/ filter gives me only one row per container nr. (as shown below).

Thanks! John

container_nrstatus_codorder_dat
SUDU516806411017-8-2018
APRU577333411520-12-2016
1 ACCEPTED SOLUTION
TomMartens
Super User
Super User

Hey,

 

I created a calculated column in your table using this DAX statement like so:

most recent = 
var thisContainer = 'Table2'[container_nr]
var lastDateByContainerNr = 
    CALCULATE(
        MAX('Table2'[order_dat])
        ,FILTER(
            ALL('Table2')
            ,'Table2'[container_nr] = thisContainer
        )
    )
return
IF('Table2'[order_dat] = lastDateByContainerNr, "yes", "no")

This leads to this table:

image.png

 

Now you can use the column "most recent" to filter your data.

 

Hopefully this is what you are looking for!

 

Regards,

Tom

 

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

View solution in original post

1 REPLY 1
TomMartens
Super User
Super User

Hey,

 

I created a calculated column in your table using this DAX statement like so:

most recent = 
var thisContainer = 'Table2'[container_nr]
var lastDateByContainerNr = 
    CALCULATE(
        MAX('Table2'[order_dat])
        ,FILTER(
            ALL('Table2')
            ,'Table2'[container_nr] = thisContainer
        )
    )
return
IF('Table2'[order_dat] = lastDateByContainerNr, "yes", "no")

This leads to this table:

image.png

 

Now you can use the column "most recent" to filter your data.

 

Hopefully this is what you are looking for!

 

Regards,

Tom

 

 

 



Did I answer your question? Mark my post as a solution, this will help others!

Proud to be a Super User!
I accept Kudos 😉
Hamburg, Germany

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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