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

LOOKUP VALUE or FIRSTNONBLANK to retrieve FIRST than SECOND than THIRD ... RESULTS

Hi

I have a very long source table that i'm using for another one, i will resume my problem in below

Trucks       Entered                 

A             01.01.2021       

B             06.03.2021       

C             12.04.2021

A             15.01.2021    

A             28.01.2021

C             14.04.2021

... etc

I would like in the other table to search for the first time, second time, third time ... every truck entred

I tried to use LOOKUPVALUE and FIRSTNONBLANK but is always giving me the first result

I want it in a column not in a measure

 

Thanks

1 ACCEPTED SOLUTION
v-zhangti
Community Support
Community Support

Hi, @MoumouhElRebeld 

 

You can try the following methods.

Table2:

Table 2 = VALUES('Table'[Trucks])

Column:

FIRST = 
CALCULATE(MIN('Table'[Entered]),FILTER(ALL('Table'),[Trucks]=EARLIER('Table 2'[Trucks])))
SECOND = 
CALCULATE(MIN('Table'[Entered]),FILTER(ALL('Table'),[Trucks]=EARLIER('Table 2'[Trucks])&&[Entered]<>[FIRST]))
THIRD = 
CALCULATE(MIN('Table'[Entered]),FILTER(ALL('Table'),[Trucks]=EARLIER('Table 2'[Trucks])&&[Entered]<>[FIRST]&&[Entered]<>[SECOND]))

vzhangti_0-1647408966017.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

3 REPLIES 3
v-zhangti
Community Support
Community Support

Hi, @MoumouhElRebeld 

 

You can try the following methods.

Table2:

Table 2 = VALUES('Table'[Trucks])

Column:

FIRST = 
CALCULATE(MIN('Table'[Entered]),FILTER(ALL('Table'),[Trucks]=EARLIER('Table 2'[Trucks])))
SECOND = 
CALCULATE(MIN('Table'[Entered]),FILTER(ALL('Table'),[Trucks]=EARLIER('Table 2'[Trucks])&&[Entered]<>[FIRST]))
THIRD = 
CALCULATE(MIN('Table'[Entered]),FILTER(ALL('Table'),[Trucks]=EARLIER('Table 2'[Trucks])&&[Entered]<>[FIRST]&&[Entered]<>[SECOND]))

vzhangti_0-1647408966017.png

Is this the result you expect?

 

Best Regards,

Community Support Team _Charlotte

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

CNENFRNL
Community Champion
Community Champion

CNENFRNL_0-1647197404421.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

Thanks

What is LOGS[Return] pls ?

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.