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
Anonymous
Not applicable

How to get a Value from the second newst row

Hey Everyone, how are u all doing?

I have an ORDER table, which contains these columns:

Order_ID, Client_ID, Date_of_Order

I also have a CLIENT table that links with the Client_ID column from the ORDER table.

I was getting some info from each client (inside the Client Table), what is the first Order ID.

So I created the measure: MIN (Order_ID) in a calculed column inside the Client Table. And that gives me the Order ID from the first row of this client.

But I need to analyze also the SECOND Order ID of this client.

Does anyone have any idea how to crack this?

Thank you so much for your attention!

Best Regards

4 REPLIES 4
v-janeyg-msft
Community Support
Community Support

Hi, @Anonymous 

 

You didn't explain the relationship between the Client_ID column in the two tables. So I'm not clear about the logic of the SECOND Order ID of this client. Can you share some sample data about the two tables or explain it? Then we can help you modify the measure quickly and accurately.

 

Best Regards,
Community Support Team _ Janey

Anonymous
Not applicable

Hey! I'm sorry for being a bit superficial.

There is a Client Table which contains the client information (tel, email, client_id)

And I created a calculated column that shows the first order ID using the measure: MIN(order_id) from the Order Table that contains (Order_id, value, client_id)

@Anonymous 

 

It is troublesome for us to create data out of thin air.

Your needs are not difficult, if you can provide a simple sample, I think we can help you soon. 

Reference:

How to Get Your Question Answered Quickly - Microsoft Power BI Community

 

Best Regards,
Community Support Team _ Janey

rsbin
Super User
Super User

@Anonymous,

Just thinking out loud, but I think the RANKX function can be used to solve your problem.  Create a calculated column to Rank each Order_ID by Client_ID.  Then filter on Rank = 1 or Rank = 2 (depending on how you decide best to rank the Orders).  Don't know the exact syntax, but just throwing out an idea.

Good Luck and Regards,

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.