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
lekkerbek
Helper IV
Helper IV

Unpivot columns

Hi,

 

The solution is probably easy, but I can't get it to work as the outcome is not the same if I manually calculate.

 

I have an excelsheet covering the following:

 

Article nrArticle group0-30 number0- 30 value31-60 number31-60 value61-90 number61-90 value
001Article name1€ 10,505€ 52,502€ 21

 

I would like it to look like:

 

Article nrArticle groupAgeNumberValue
001Article name0-301€ 10,50
001Article name31-605€ 52,50
001Article name61-902€ 21

 

Could someone help me with this please? When I tried unpivotting I got duplicates and when I tried to remove those I apparantly removed too much as the total sum did not match the excelsheet anymore.

 

Screenshot.PNG

 

 

Thanks in advance. 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @lekkerbek ,

 

Please follow the below steps to acheive your request. 

  • First Unpivot the columns Fig 1.1
  • Split the columns based on space delimiter to the Right-most delimiter Fig 1.2 and 1.3.
  • Pivot the Number and Values to columns based on Value column Fig1.4.


Fig 1.1:
Unpivot.PNG

Fig 1.2:

Delimit.PNG

Fig 1.3:
Split_Columns.PNG
Fig 1.4:
Final.PNG

 


Best Regards,
Mail2inba4

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hi @lekkerbek ,

 

Please follow the below steps to acheive your request. 

  • First Unpivot the columns Fig 1.1
  • Split the columns based on space delimiter to the Right-most delimiter Fig 1.2 and 1.3.
  • Pivot the Number and Values to columns based on Value column Fig1.4.


Fig 1.1:
Unpivot.PNG

Fig 1.2:

Delimit.PNG

Fig 1.3:
Split_Columns.PNG
Fig 1.4:
Final.PNG

 


Best Regards,
Mail2inba4

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Thank you both @Anonymous  and @Tahreem24 for your time to help me. Much appreciated.

Tahreem24
Super User
Super User

@lekkerbek ,

You want something like below screen shot? (I tried to replica your requirement at my side)

Please Give KUDOS to my post and accept this as a solution if it helps you!

 

Capture.JPG

 

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

@lekkerbek ,

 

Yeah, the Number Column is nothing but the Value column.

Capture.JPG

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

The number column should reflect the number of articles in stock. The value column reflects the total value of the stock of that article. Those two can't be combined into one column.

@lekkerbek ,

 

Can you please give screen shot or upload Excel with sample data?

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

I seem to be unable to upload an excelfile, so I included a screenshot in the opening post (and also here).

 

Screenshot.PNG

 

Hi @lekkerbek ,

 

I replicated your scenario at my end. Let me know if I missed anything. 

Please dont forget to give KUDOS!

 

Input:

Input.JPG

 

Output:

Output.JPG

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard

@Tahreem24  yes, but it should also include the column "value".

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.