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

Return value if value appears after date in second table

Hey, 

 

I have an interesting problem that I cannot seem to wrap my mind around. 

Basically, I have two different tables with the same order numbers. One table(Table1) declares what is being put in an order, while the second table(Table2) declares when that order has been finished. 

However, the problem is when a part of an order gets added to table1 after the order has been finished in table2. (This often happens when an item (or several) are not in stock, but get in stock later etc.).

 

So what I would like, is to add an "-1" or something similar in Table 1 after the order number, to indicate that the order has been finished one time (or more). 

 

The tables look like this; 

 

Table 1 (with desired result)

Sgb1201_1-1673513529069.png

Ideally it should be able to add -1, -2, -3, etc. if there are more than 2 occurences in table 2. 

 

Table 2: 

Sgb1201_2-1673513674185.png

Any help is appreciated! 
Let me know if something is unclear, etc. 

Thanks. 

2 REPLIES 2
Anonymous
Not applicable

HI @Anonymous,

I check the two table records but can't find the unique field to mapping two table detailed records for Dax formula coding. Can you please share more detail information about these?

How to Get Your Question Answered Quickly  

Regards,

Xiaoxin Sheng

Anonymous
Not applicable

Hi @Anonymous,

Thanks for the reply. 

 

Do you mean the unique identifier for the two tables? The OrderNumber columns are the ones linking the two tables. 

Let me show you a better example; (Table1)

Sgb1201_3-1673591051914.png

Table2;

Sgb1201_9-1673594537111.png

The only relevant columns are the green ones. So if there are any occurences of a value in the OrderNumber column (Table1) with a later transaction date (Table 1) than in the first ErrorDate (table 2) for the same OrderNumber, the OrderNumber should get a "-1" at the end of the OrderNumber (see DesiredResult / Value2 column).

 

I hope that helped clear things up a bit. 

 

 

 

 

 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Top Solution Authors