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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

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
v-shex-msft
Community Support
Community Support

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

Community Support Team _ Xiaoxin
If this post helps, please consider accept as solution to help other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors