This is best Fabric, Power BI, SQL and AI community event. How do we know? The last event sold out! Save €200 with code FABCMTY200.
Register nowA new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.
Hello,
I have a data set with the following structure (columns)
Attribute SalesYear1 SalesYear1 SalesYear1 CostYear1 CostYear2 CostYear3
I would like to transform this into the following structure (columns)
Attribute Year Sales Costs
I think it would be staright forward without the cost column. However, I don't know how to unpiviot into more than two rows.
Thank you in advance for any help
Solved! Go to Solution.
Duplicate the query.
In one, unpivot the Sales columns and remove the cost columns.
In the other, unpivot the Costs and remove the sales columns.
In each query, alter the data so you have Year in a column by itself
'Merge as New' the two queries on Year and Division (Inner Join).
Expand and tidy as appropriate.
Can you provide some sample data please
This is an example: I can unpivot the three sales columns into two columns (year & sales Value). However; iwould like to have three columns (year, sales value & cost value)
Duplicate the query.
In one, unpivot the Sales columns and remove the cost columns.
In the other, unpivot the Costs and remove the sales columns.
In each query, alter the data so you have Year in a column by itself
'Merge as New' the two queries on Year and Division (Inner Join).
Expand and tidy as appropriate.
This worked out! Thank you for your time & effort to look into this! I appreciate your help!
Check out the May 2026 Power BI update to learn about new features.
Sign up to receive a private message when registration opens and key events begin.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
| User | Count |
|---|---|
| 29 | |
| 28 | |
| 25 | |
| 19 | |
| 14 |
| User | Count |
|---|---|
| 53 | |
| 47 | |
| 27 | |
| 20 | |
| 19 |