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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
tusmo
Frequent Visitor

Help with a certain type of data transformation

I have only worked with Power BI for a couple weeks now, but I've noticed a certain pattern of data transformation I need to do repeatedly. For example I might have time series data with columns: Date | Sales of product A in region X | Sales of product A in region Y | Sales of product B in region X | Sales of product B in region Y. Now I want to visualize sales accross different product types and regions. In order to do that I transform the data into the following form: Date | Product | Region | Sales, now I can easily create interactive visualizations. However, as the number of differerent labels, in this case products and regions, increases doing this manually in the Query editor becomes tedious. Is there a way to easily do this within Power BI? I did write a Python script to do this for me but that's an additional step in the workflow I'd rather get rid off.

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@tusmo

 

You can do Edit Queries, Select your Date column, right click and do Unpivot Other Columns.

This will give you Date column, Attribute Column and Value Column. You can rename Attribute and Value as required.

After this, select Attribute column, go to Add Column, use Column from Examples, create 2 columns for Color and Country.

 

Regards

View solution in original post

4 REPLIES 4
Greg_Deckler
Community Champion
Community Champion

Would need an example of your source data and desired output. Can't really visualize your manual steps. Please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you for you answer, I'm sorry if my description of the problem was inadequate. Lets say that for example I have data that looks like this:

data1.png

 , and I want to create a chart where you can interactively visualize the data like this:

sales.png

 

 

So what I need to do is to transform the data into the following form:

 

data2.png

 

 

My question is, what would be the easiest way to do this transformation within Power BI for some arbitrary numbers of paint colors and countries? The way I'm doing it right now is by manually duplicating the original table, deleting all but one row, for example "Sales of red paint in Germany" and then adding custom columns "Red" and "Germany" and then appending the tables.

 

 

 

 

Anonymous
Not applicable

@tusmo

 

You can do Edit Queries, Select your Date column, right click and do Unpivot Other Columns.

This will give you Date column, Attribute Column and Value Column. You can rename Attribute and Value as required.

After this, select Attribute column, go to Add Column, use Column from Examples, create 2 columns for Color and Country.

 

Regards

This works great! I'm new working with data in general so I wasn't familiar with the concept of pivoting and I didn't know of the "Column from examples" function, it seems extremely useful. The data I'm working with is formatted nicely enough that I can also use "split column - by delimiter" to achieve this even more easily.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors