cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Iheb_Ghali
Frequent Visitor

Create column above columns

Hello everybody,

is there a way to do this??

 

sss.png

 

in the source table columns are: pieni_export,cmp_export,gp_export,vid_export,pieni_import,cmp_import,gp_import,vid_import

 

i want to show them like the way above using matrix Smiley Sad 

1 ACCEPTED SOLUTION
v-haibl-msft
Microsoft
Microsoft

@Iheb_Ghali

 

We need to do some transforms to you source table in Query Editor firstly. Assuming we have a Table1 like below.

Create column above columns_1.jpg

 

  1. Select all columns in Table1 and click Unpivot Columns in Transform ribbon.
    Create column above columns_2.jpg
  2. Rename Attribute to SubType.
  3. Select SubType and click Split Column by Delimiter in Home ribbon.
    Create column above columns_3.jpg
  4. Rename SubType.1 to SubType, SubType.2 to Type.
    Create column above columns_4.jpg
  5. Right click Table1 in left Queries pane and select Duplicate, rename the duplicated table to Table2.
  6. Remove the Type column in Table2 and add another new custom column named Type with “TOTAL” string.
    Create column above columns_5.jpg
  7. Click Group By in the Home ribbon, sum the values group by Type and SubType.
    Create column above columns_6.jpg
  8. Select Table1 in left Queries pane and click Append Queries in Home ribbon. Select Table2 to append.
    Create column above columns_7.jpg
  9. Close & Apply Query Editor. Drag Type and SubType into Columns, Value into Values in Matrix.
    Create column above columns_8.jpg

I’ve also uploaded my PBIX file here for reference.

 

Best Regards,

Herbert

View solution in original post

4 REPLIES 4
v-haibl-msft
Microsoft
Microsoft

@Iheb_Ghali

 

We need to do some transforms to you source table in Query Editor firstly. Assuming we have a Table1 like below.

Create column above columns_1.jpg

 

  1. Select all columns in Table1 and click Unpivot Columns in Transform ribbon.
    Create column above columns_2.jpg
  2. Rename Attribute to SubType.
  3. Select SubType and click Split Column by Delimiter in Home ribbon.
    Create column above columns_3.jpg
  4. Rename SubType.1 to SubType, SubType.2 to Type.
    Create column above columns_4.jpg
  5. Right click Table1 in left Queries pane and select Duplicate, rename the duplicated table to Table2.
  6. Remove the Type column in Table2 and add another new custom column named Type with “TOTAL” string.
    Create column above columns_5.jpg
  7. Click Group By in the Home ribbon, sum the values group by Type and SubType.
    Create column above columns_6.jpg
  8. Select Table1 in left Queries pane and click Append Queries in Home ribbon. Select Table2 to append.
    Create column above columns_7.jpg
  9. Close & Apply Query Editor. Drag Type and SubType into Columns, Value into Values in Matrix.
    Create column above columns_8.jpg

I’ve also uploaded my PBIX file here for reference.

 

Best Regards,

Herbert

Thank you very much @v-haibl-msft !!!

 

You saved my life, its working like magic Smiley Happy

very Very nice solution

HeroPost
Frequent Visitor

Hi,

it can be done, but you may have to edit your source data, so the export, and import ar dimensions in one column and Pieni, CMP, GP and vid are in another column

then you can use the dimensions as columns in a matrix visual

 

Helpful resources

Announcements
PBI Sept Update Carousel

Power BI September 2023 Update

Take a look at the September 2023 Power BI update to learn more.

Learn Live

Learn Live: Event Series

Join Microsoft Reactor and learn from developers.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

MPPC 2023 PBI Carousel

Power Platform Conference-Power BI and Fabric Sessions

Join us Oct 1 - 6 in Las Vegas for the Microsoft Power Platform Conference.

Top Solution Authors