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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Nipius
Advocate I
Advocate I

Add column based on value other query

Hi all!

 

I have a dataset with two queries on a group of employees. 

 

Query A loads data from a monthly updated database, where I've applied the step to only keep the data for the snapshots with the newest date (in this case "2019M05") and the data for snapshots at the end of the year ("XXXM12").

 

Query B loads data from an Excel report, which has no snapshot column and is based on the situation as per the current day.

 

In Query A, I apply a step where I create a column to make a unique identifier, combining the snapshot and the employee ID. So if employee 48193 has been working for 4 years within our company, this person will get the following four unique identifiers for each of the 4 rows this person is in:

 

Employee ID    |    Snapshot    |     Unique Identifier

48193              |     2019M05   |     2019M0548193

48193              |     2018M12   |     2018M1248193  

48193              |     2017M12   |     2017M1248193   

48193              |     2016M12   |     2016M1248193

 

The issue is creating the right relationship between my two queries. In Query B, I'd like to add a Unique Identifier column as well, based on the youngest snapshot date in Query A (as there is no snapshot in query B and the data in query B is only applicable to the youngest rows in Query A).

 

Any support would be much appreciated 🙂

1 REPLY 1
Anonymous
Not applicable

Hi @Nipius,

I'm not so clear for 'query B' data structure, can you please explain more about this?

How to Get Your Question Answered Quickly

In addition, you can consider to add column to extract and merge year part and employee id to create a bridge table to link two tables.

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.