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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
thhmez7
Helper III
Helper III

DAX - Show latest two column value by Date

Hello,

I'd like to create a measure, that show the latest two attributes of the column Type by Date.

So in this example for Brand A, the measure should only show Type = "Red" on April and May. For Brand B it should show Blue in April and Red in May. The attributes can be concatenated or displayed in each row. 

thhmez7_0-1655801130755.png

Thank you for your help.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@thhmez7 , if you do not want that based on slicer value, You can use column rank and use that as filter

 

rank = rankx(filter(Table, [Brand] = earlier([Brand]) ) , [Date],,desc,dense)

 

filter for <= 2 in a measure of visual level filter

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@thhmez7 , if you do not want that based on slicer value, You can use column rank and use that as filter

 

rank = rankx(filter(Table, [Brand] = earlier([Brand]) ) , [Date],,desc,dense)

 

filter for <= 2 in a measure of visual level filter

Thank you.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.