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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Dmoetnogleren
Regular Visitor

Filter question

Hello,

 

Can anyone help with the following?

 

I have a DIMtable like this:

IDName person
1X
2Y

 

And a Fact table like this:

IDStartdate
110-10-2020
21-8-2022
227-1-2023

 

I want from everyone the most recent startdate in the DIM table. Person 1 had only one startdate (10-10-2020), so I want 10-10-2020 in the return as most recent start date. For person 2 I want 27-1-2023 returned as most recent startdate.

 

Thank you in advance!

1 ACCEPTED SOLUTION
Dmoetnogleren
Regular Visitor

Thank you for your answers. I cannot get it working, but I found another solution:

RecentStartDate = LASTDATE('Fact'[Start Date])

 

View solution in original post

3 REPLIES 3
Dmoetnogleren
Regular Visitor

Thank you for your answers. I cannot get it working, but I found another solution:

RecentStartDate = LASTDATE('Fact'[Start Date])

 

v-yilong-msft
Community Support
Community Support

Hi @Dmoetnogleren ,

I create two tables and create One-to-Many relationship.

vyilongmsft_0-1718078736049.png

vyilongmsft_1-1718078784957.png

Then I create a measure and here is the DAX code.

RecentDate = 
CALCULATE(
    MAX(FactTable[Startdate]),
    FILTER(
        FactTable,
        FactTable[ID] = RELATED(DIMtable[ID])
    )
)

vyilongmsft_2-1718078991637.png

 

 

 

Best Regards

Yilong Zhou

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Kaviraj11
Super User
Super User

Hi,

 

Please create a measure as below and make sure to have a relationship between ID from two tables:

 

MostRecentStartDate =
VAR MaxDatePerID =
    CALCULATE(
        MAX('Fact'[StartDate]),
        ALLEXCEPT(Dim, Dim[ID])
    )
RETURN
    MaxDatePerID
 
Kaviraj11_0-1718034740158.png

 

Regards,

Kaviraj




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

Proud to be a Super User!





Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.