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.
Hi,
I am wonder if there is any clever way to unpivot columns in Power BI with two types of columns (sales ammount by month and Quantity per month) in Direct Query.
From:
Client | City | Product ID | June 2020 (Sales Amount) | June 2020 (Quantity) | July 2020 (Sales Amount) | July 2020 (Quantity) | August 2020 (Sales Amount) | August 2020 (Quantity) |
A | X | 1234 | 100 | 1 | 1000 | 10 | 10000 | 100 |
B | Y | 1345 | 50 | 1 | 2500 | 50 | 5000 | 100 |
C | Z | 1456 | 10 | 1 | 50 | 5 | 0 | 0 |
To:
City | Product ID | Date | Sales Amount | Quantity | |
A | X | 1234 | June 2020 | 100 | 1 |
A | X | 1234 | July 2020 | 1000 | 10 |
A | X | 1234 | August 2020 | 10000 | 100 |
B | XY | 1345 | June 2020 | 50 | 1 |
B | XY | 1345 | July 2020 | 2500 | 50 |
B | XY | 1345 | August 2020 | 5000 | 100 |
C | XYZ | 1456 | June 2020 | 10 | 1 |
C | XYZ | 1456 | July 2020 | 50 | 5 |
C | XYZ | 1456 | August 2020 | 0 | 0 |
Thank you in advance for any hints!,
Karo
Copying DAX from this post? Click here for a hack to quickly replace it with your own table names
Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C
I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com
hi @AllisonKennedy ,
thank you for your reply, however few steps are not supported in Direct Query (example: Split Column by Delimiter).
regards,
karo
Hi @karo ,
Check the similar thread below:
https://community.powerbi.com/t5/Desktop/Using-dax-to-unpivot-a-table/td-p/421116
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
114 | |
98 | |
86 | |
70 | |
62 |
User | Count |
---|---|
151 | |
120 | |
103 | |
87 | |
68 |