Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am trying to Transpose data using DAX rather than the power query method but finding it tricky to convert a single row into multiple columns whilst turning several columns into rows.
As an example my table is as follows
Location | A | B | C | D | E |
City1 | 1 | 2 | 3 | 4 | 5 |
City2 | 6 | 7 | 8 | 9 | 10 |
City3 | 11 | 12 | 13 | 14 | 15 |
City4 | 16 | 17 | 18 | 19 | 20 |
I would like to convert it to
City1 | City2 | City3 | City4 | |
A | 1 | 6 | 11 | 16 |
B | 2 | 7 | 12 | 17 |
C | 3 | 8 | 13 | 18 |
D | 4 | 9 | 14 | 19 |
E | 5 | 10 | 15 | 20 |
I managed to convert the columns into rows using the UNION and SELECTCOLUMNS but don't know how to transpose the location field into columns.
The formula I have used so far is as follows
NewTable =
),
))
Any help would be appreciated.
This should do the trick:
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
User | Count |
---|---|
25 | |
11 | |
8 | |
6 | |
6 |
User | Count |
---|---|
30 | |
13 | |
11 | |
9 | |
6 |