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
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.


Go to My LinkedIn Page


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.


Go to My LinkedIn Page


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.


Go to My LinkedIn Page


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.

Top Solution Authors