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
jp278
Frequent Visitor

Joining data from another table with specific parameters

Hi all,

 

Hope you can help me with this one as i haven't been able to find a solution despite repeated attempts. I'm a newbie so bear with me.

 

I have two databases/tables that is linked to in power bi

 

a) The first one has the primary key like below

 

SNo.      Unrelated data

1            Unrel data 1

2            Unrel data 2

 

 

b) the second database has three fields, the primary key fromthe above database, the date, and comments, so for example, entries would be 

 

SNo   Date         Comments

1        10Sep       I have a pen

1        11Sep       he has a pen

1        12Sep       we have a pen

2        11Sep       they have a pen

2        12Sep       she has a pen

 

What i want to do is, in the first table, i want to take comments in from the second table BUT i want only the latest 2 comments AND i want to have the comments within one singe cell,

 

SNo.      Unrelated data            Date         Comments

1            Unrel data 1               12Sep       we have a pen

                                                 11Sep       he has a pen

2            Unrel data 2               12Sep       she has a pen

                                                 11Sep       they have a pen

 

Please note that the date and comments for each SNo, is fitted into just one cell each. How do i do this? I have not been able to figure this one out. 

 

 

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

Hi @jp278 

Create measures

measure date = MAX('Table 2'[Date])

Measure rank = IF([measure date]<>BLANK(),RANKX(ALLEXCEPT('Table 2','Table 2'[SNo]),[measure date],,DESC,Dense))

Capture1.JPGCapture2.JPG

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-juanli-msft
Community Support
Community Support

Hi @jp278 

Create measures

measure date = MAX('Table 2'[Date])

Measure rank = IF([measure date]<>BLANK(),RANKX(ALLEXCEPT('Table 2','Table 2'[SNo]),[measure date],,DESC,Dense))

Capture1.JPGCapture2.JPG

 

Best Regards
Maggie
Community Support Team _ Maggie Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
jp278
Frequent Visitor

Have i not worded the question well enough? perhaps i need to redo this? Could someone help? I am new to this community. thanks.

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.