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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Julia_Mav
Helper II
Helper II

Unique value for joining

Hi everyone,

I'm having trouble creating a unique key to join two tables in Power BI. I would appreciate it if someone could advise me on how to create this unique key in Power BI with the 'Material' field, using a rule that involves selecting the 'Part Number' with the most recent 'Date Effective'.

The key value with 'Material/ValidFromYear' (25621352100/2020) is not working; see below. 

 

Thanks in advance.

 

Screenshot 2023-10-17 at 16.52.50.png

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Julia_Mav ,

Do you want to get the part number with the most recent effective data for per material? If yes, you can create a calculated column as below to get it, please find the details in the attachment.

Column = 
VAR _maxdate =
    CALCULATE (
        MAX ( 'Table'[Date Effective] ),
        FILTER ( 'Table', 'Table'[Material] = EARLIER ( 'Table'[Material] ) )
    )
RETURN
    IF ( 'Table'[Date Effective] = _maxdate, 'Table'[Part number] )

vyiruanmsft_0-1698315282839.png

Best Regards

View solution in original post

3 REPLIES 3
KEAlexander
Helper I
Helper I

Hi Julia, when you say "not working" would you please give more details on exactly what is going wrong?

Hi @KEAlexander, it does not provide the Part number with the most recent Effective date. It gives the value that is in B2, while B3 is needed.  Thanks!

Anonymous
Not applicable

Hi @Julia_Mav ,

Do you want to get the part number with the most recent effective data for per material? If yes, you can create a calculated column as below to get it, please find the details in the attachment.

Column = 
VAR _maxdate =
    CALCULATE (
        MAX ( 'Table'[Date Effective] ),
        FILTER ( 'Table', 'Table'[Material] = EARLIER ( 'Table'[Material] ) )
    )
RETURN
    IF ( 'Table'[Date Effective] = _maxdate, 'Table'[Part number] )

vyiruanmsft_0-1698315282839.png

Best Regards

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors