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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AskGenie
Frequent Visitor

Pivot Challenge

I'm hoping someone can steer me in the right direction.  I have a table with a list of employees and and calculated benefits for their weekly check.  I need to be able to upload this data but I'm not sure how I can perform this transformation.  The original table lists a row for every benefit but I need to pivot this so I only get one line per employee.  To make it more challenging, not every employee has the same number of benefits so one one employee the first benefit might be Annuity but for the next the first may be INS.  The transposition below is the closest I've gotten.  I need the first row to be column 1.  Any help would be GREATLY appreciated.

 

AskGenie_0-1660306740202.png

 

 

AskGenie_0-1660298081532.png

 

1 ACCEPTED SOLUTION

Hi @AskGenie ,

 

My apology for not paying enough attention.

 

Starting point: (Based on the file I attached earlier) Step: Changed Type

KT_Bsmart2gethe_0-1660726302346.png

 

We need two steps to achieve the outcome:

Step1: GroupBy

KT_Bsmart2gethe_1-1660726469215.png

Once the GroupBy step generated, go to the formula bar replace the highlighted code below (Image A) with highlighted in Image B.

Image A

KT_Bsmart2gethe_2-1660726655175.png

 

Image B

KT_Bsmart2gethe_3-1660726813851.png

 

The next step is add a custom column with code below:

KT_Bsmart2gethe_4-1660726877084.png

 

The final step is to combine all the tables by adding a custom step (blue circle below) and add the highlighted code:

KT_Bsmart2gethe_5-1660726996710.png

 

Regards

KT

 

 

 

 

View solution in original post

6 REPLIES 6
AskGenie
Frequent Visitor

BRILLIANT!  Thank you soooo much.  I don't exactly understand what we did here but it works perfectly.  🙂

AskGenie
Frequent Visitor

Thank you for your response, however, forgive me but I don't understand.  should I implement your suggestion starting from from where I left off (employee code at top) or from my original table?   What would a lookup formula for this look like?  Thank you.

Hi @AskGenie ,

 

My apology for not paying enough attention.

 

Starting point: (Based on the file I attached earlier) Step: Changed Type

KT_Bsmart2gethe_0-1660726302346.png

 

We need two steps to achieve the outcome:

Step1: GroupBy

KT_Bsmart2gethe_1-1660726469215.png

Once the GroupBy step generated, go to the formula bar replace the highlighted code below (Image A) with highlighted in Image B.

Image A

KT_Bsmart2gethe_2-1660726655175.png

 

Image B

KT_Bsmart2gethe_3-1660726813851.png

 

The next step is add a custom column with code below:

KT_Bsmart2gethe_4-1660726877084.png

 

The final step is to combine all the tables by adding a custom step (blue circle below) and add the highlighted code:

KT_Bsmart2gethe_5-1660726996710.png

 

Regards

KT

 

 

 

 

Hi @AskGenie ,

 

I missed out on your first image. I was looking at the second one.

I mocked up the data as per the first image in excel, and please below link for the solution:

 

Solution 

 

Regards

KT

I may have mis stated.  I need the exact opposit.  I need this

AskGenie_0-1660723442215.png

to look like this

 

AskGenie_1-1660723534560.png

 

Thank you.

KT_Bsmart2gethe
Impactful Individual
Impactful Individual

Hi @AskGenie ,

 

There are a few ways to achieve the outcome.

One of the way is:

  1. Unpivot all the columns that forming the two column you want (i.e. PEN, $$ COP $$ etc),
  2. add index column,
  3. perform a lookup function with the help of the index column to get the previous row for the value or the name (i.e. PEN / COP), and this will set the benefits and it value next to each other,
  4. filter out the unnecessary rows.

Regards

KT

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors