Forum Discussion
Combining multiple columns into one column
Following is the data i have in my sql table
| Date | Unit | Anchor | LU |
| 20171231 | ESG | 134.08 | 156.68 |
| 20180228 | OUT | 23.56 | 11.51 |
| 20171231 | OUT | 525.58 | 620.05 |
| 20180430 | GNS | 0 | 0 |
| 20180630 | GNS | 0 | 0 |
| 20180331 | ANS | 1.5333 | 15.3775 |
| 20180430 | ESG | 0 | 15.9999 |
| 20180531 | ANS | 11.8999 | 45.0722 |
But in power bi visualisation they would like to show it by each month wise and by combining (unit and Anchor),(unit and LU) and then overall totals.
| Date | 12/31/2017 | 01/22/2018 | 01/31/2018 | 02/28/2018 | 03/31/2018 | 04/30/2018 |
| OUT Anchors | 525.58 | 2.86 | 6.15 | 23.56 | 24.00 | 25.30 |
| OUT LU | 620.05 | 4.11 | 7.85 | 11.51 | 12.34 | 14.91 |
| Total OUT | 1,145.63 | 6.97 | 14.00 | 35.08 | 36.34 | 40.22 |
| ESG Anchors | 134.08 | - | - | 6.96 | 6.96 | 10.60 |
| ESG LU | 156.68 | - | - | - | - | - |
| Total ESG | 290.77 | - | - | 6.96 | 6.96 | 10.60 |
| ANS Anchors | 203.19 | - | - | - | - | 10.61 |
| ANS LU | 1.67 | - | - | - | - | - |
| Total ANS | 204.86 | - | - | - | - | 10.61 |
| GNS | - | 15.83 | 15.83 | 15.83 | 15.83 | |
| Total Anchors | 862.85 | 2.86 | 21.99 | 46.35 | 46.79 | 62.35 |
| Total LU | 778.40 | 4.11 | 7.85 | 11.51 | 12.34 | 14.91 |
| Total | 1,641.26 | 6.97 | 29.84 | 57.87 | 59.13 | 77.26 |
How can it be done.Can someone please help.
Thanks.
In the Query Editor
1) Select the Date and Unit Columns (Ctrl+Select)
2) Transfom tab - Unpivot Columns - Unpivot Other Columns
3) You can rename the Attribute and Value columns as you choose
4) Home tab - Close & Apply
5) Click the icon for a Matrix Visual
6) Drag the Unit and Attribute columns to the Rows
7) Drag the Date to the Columns (if you get a Date Hierarchy - right-click and select date)
8 ) Finally add the Value field to the Values
9) Click the Expand All Down one down level in the hierarchy button in the Visual Header
10) With the Matrix still selected click the Format (Paint Brush)
11) open the Subtotals options - scroll down to see the Row subtotal position dropdown - select bottom
That should do it! :smileyhappy:
2 Replies
- Sean
Community Champion
In the Query Editor
1) Select the Date and Unit Columns (Ctrl+Select)
2) Transfom tab - Unpivot Columns - Unpivot Other Columns
3) You can rename the Attribute and Value columns as you choose
4) Home tab - Close & Apply
5) Click the icon for a Matrix Visual
6) Drag the Unit and Attribute columns to the Rows
7) Drag the Date to the Columns (if you get a Date Hierarchy - right-click and select date)
8 ) Finally add the Value field to the Values
9) Click the Expand All Down one down level in the hierarchy button in the Visual Header
10) With the Matrix still selected click the Format (Paint Brush)
11) open the Subtotals options - scroll down to see the Row subtotal position dropdown - select bottom
That should do it! :smileyhappy:
- AnonymousNot applicable
Thanks Sean.It worked out.