Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
8 years ago
Solved

Combining multiple columns into one column

Following is the data i have in my sql table 

DateUnitAnchorLU
20171231ESG134.08156.68
20180228OUT23.5611.51
20171231OUT525.58620.05
20180430GNS00
20180630GNS00
20180331ANS1.533315.3775
20180430ESG015.9999
20180531ANS11.899945.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.

Date12/31/201701/22/201801/31/201802/28/201803/31/201804/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's avatar
    Sean
    Icon for Community Champion rankCommunity 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:

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks Sean.It worked out.