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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Unpivoting?

Hi all! I've been scratching my head with the following modeling issue... I am importing a Sharepoint List of employees located in different sites... The structure of this list is:

- one site per row

- up to 32 groups of columns with details for up to 32 employes on each site:

  • Staff1_Name, Staff1_Email, Staff1_tel, Staff1_job,
  • Staff2_Name, Staff2_Email, Staff2_tel, Staff2_job...

I'd need to "somehow" modify the query so that I would end up with the following structure:

- one site+employee per row

- up to 32 rows for one site

- One colum for name, one for Tel, one for email, one for Job, and one as Staff#

 

Any idea? The worst that came to my mind is to duplicate 32 times this initial query, keeping only one Staff in each duplicated query, and then merge back the 32 queries... pretty weird, right?

 

Thx for your inputs,

Ben

Capture.JPG

1 ACCEPTED SOLUTION

@Anonymous

 

Hi, Try with a combination of Unpivot & Pivot.

 

Check the PBIX.

 

PD: If you want to mantain the Staff 1,2,3...

 

Do This:

 

Staff.png

 

 

Regards

 

Victor




Lima - Peru

View solution in original post

4 REPLIES 4
Aron_Moore
Solution Specialist
Solution Specialist

Unpivot should get you real close. Using a sample dummy set I selected all non-site columns and click unpivot. Viola!

 

Capture.PNG

 

In query editor

Capture1.PNG

Result:

Capture2.PNG

 

 

Anonymous
Not applicable

Hi Aron,

thx for your input, but it doesn't solve the issue I'm afraid, as this puts for instance for Staff1 the attributes in different rows, whereas we want them in column... 😞

@Anonymous

 

Hi, Try with a combination of Unpivot & Pivot.

 

Check the PBIX.

 

PD: If you want to mantain the Staff 1,2,3...

 

Do This:

 

Staff.png

 

 

Regards

 

Victor




Lima - Peru
Anonymous
Not applicable

Vvelarde, this is exactly it, thx!!!!!!!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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