Forum Discussion
Transpose and group table
Hi everyone,
I currently got the task to rearrange a table so it has a different format, but I can't figure our how.
The specifications of the article numbers need to be paste behind the article number (grouped).
I also have a count in the last column. If the count is < then 2 then the specification name doesn't need to be in the table
Unfortunatly it is not possible to do this in the query editor, so it has to be DAX or an other creative way.
Example;
| Articlenumber | Specification 1 | Specification 2 |
| 12345 | Color | Height |
My current table (visual table);
| Articlenumber | Specification | Count |
| 12345 | Color | 4 |
| 12345 | Height | 2 |
| 54321 | Color | 2 |
| 54321 | Width | 2 |
| 54321 | Material | 2 |
| 65432 | Color | 1 |
It would really help me out!
Thanks,
Hi Anonymous ,
First create an index column in query editor:
Then choose column "Specification" >unpivot columns:
Then back to table Data view, create 2 calculated columns:
Column = RANKX(FILTER('Table','Table'[Articlenumber]=EARLIER('Table'[Articlenumber])),'Table'[Index],'Table'[Index],ASC,Dense)Column 2 = 'Table'[Attribute] & 'Table'[Column]And a measure:
Measure = IF(MAX('Table'[Count])<2,BLANK(),MAX('Table'[Value]))Finally put column "Articlenumber","column 2" and measure to a matrix, and you will see:
For the related .pbix file,pls click here.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
2 Replies
- HotChilliCommunity Champion
Looks like the Specification columns need to be unpivoted in Power Query. Where does the Count column come from?
Perhaps you could post a larger data sample with the desired outcome.
- v-kelly-msftCommunity Support
Hi Anonymous ,
First create an index column in query editor:
Then choose column "Specification" >unpivot columns:
Then back to table Data view, create 2 calculated columns:
Column = RANKX(FILTER('Table','Table'[Articlenumber]=EARLIER('Table'[Articlenumber])),'Table'[Index],'Table'[Index],ASC,Dense)Column 2 = 'Table'[Attribute] & 'Table'[Column]And a measure:
Measure = IF(MAX('Table'[Count])<2,BLANK(),MAX('Table'[Value]))Finally put column "Articlenumber","column 2" and measure to a matrix, and you will see:
For the related .pbix file,pls click here.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!