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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
luanamoreschi
Frequent Visitor

Returning the THIRD date

 
 
Dear All,
I need to pull specifically the date of the third order of each customer due to a promotion. What I need is very similar to the formulas FIRSTDATE() and LASTDATE(), except for the fact that I need the third one. 

Have anyone ever faced this? I tried with TOPN but it didn't work and I can't find something similar in the forums.

Thanks in advance
1 ACCEPTED SOLUTION
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your dataset looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create a solution for your dataset.

I suggest creating a measure for searching the latest date inside TOP3 (ascending) dates.

 

Picture1.png

 

last date of Top three ascending: = 
IF (
    HASONEVALUE ( Customer[Customer] ),
    MAXX ( TOPN ( 3, Data, Data[Order_Date], ASC ), Data[Order_Date] )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

View solution in original post

3 REPLIES 3
Jihwan_Kim
Super User
Super User

Hi,

I am not sure how your dataset looks like, but I tried to create a sample pbix file like below.

Please check the below picture and the attached pbix file.

I hope the below can provide some ideas on how to create a solution for your dataset.

I suggest creating a measure for searching the latest date inside TOP3 (ascending) dates.

 

Picture1.png

 

last date of Top three ascending: = 
IF (
    HASONEVALUE ( Customer[Customer] ),
    MAXX ( TOPN ( 3, Data, Data[Order_Date], ASC ), Data[Order_Date] )
)

 


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Thank you so much! Exaclty what I needed. 

Just one more doubt, is it possible to ignore blank date values in this formula? Like, sometimes, when the purchase is not concluded, the date value remains blank and this is considering to the top 3. 

Thanks again!!

Hi,

Thank you for your feedback.

When checking the TOPN function, the second parameter is for inputting a table to iterate to get top 3 or bottom 3 depending on what you select between ascending vs. decending. When inputting the table into the TOPN function, If you filter out the blank, this will make iterate without considering the blank.

I hope this helps.

Thank you.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.