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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Convert rows to columns pivot while joining two tables - Power BI

Hi,

 

I have a TableA where i have the Job Detail and another TableB holds the statuses of a job. in Power BI, i need to show the Job Details and each statuses as columns with the value as Max(StatusDateTime) on the same row as job details. Can somebody tell me the best way to acheive this result please? e.g. scenario:

 

TableA    

JobNo JobNameCreatedDate
S1234Test101/01/2020

 

Table B

JobNoStatusDateTimeStatus
S123402/02/2020 03:35:23  DR
S123402/02/2020 03:55:23  DR
S123402/02/2020 04:38:23  DR
S123402/02/2020 15:35:23  VC
S123402/02/2020 15:40:23  VC
S123402/02/2020 16:33:23  PC
S123402/02/2020 16:35:23  PC

 

ExpectedResultTable

JobNo JobNameCreatedDateDRVCPC
S1234Test101/01/202002/02/2020 04:38:23 02/02/2020 15:40:23  02/02/2020 16:35:23  

 

Thanks in Advance.

4 REPLIES 4
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

Please see the attached file with a solution, that uses current structure and matrix visual.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

This is my scenario. So i retreive TableA and TableB from the database and then create  a new table using dax called JobStatus.

JobStatus = SELECTCOLUMNS('@TableB',"DocEntry",[DocEntry],"UpdateDate",[UpdateDate],"Status",[U_Status],"Age", DATEDIFF([UpdateDate],TODAY(),DAY)).

anapowerbi_0-1592913818003.png

 

Now if i want to Pivot JobStatus table i can't do it because it does not appear in Power Query Editor. Only two tables appears there which i imported from the database. JobStatus table does not appear.

 

 

image.png

 

I hope, I have managed to explain well.

 

Thanks.

 
Mariusz
Community Champion
Community Champion

Hi @Anonymous 

 

You can pivot your Table B with the setup as below.image.png

Later just Merge the tables on JobNo

 

Also, see the attached for the ref.

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Anonymous
Not applicable

Hi, Thanks for your reply. Actualy Table2 is made using DAX so i cannot use Pivot functionality of Power query editor. Any other way of doing it?

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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