Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Mace
New Member

Represent multiple column values in separate columns instead of separate rows

Hello,

I'm new to PBI and this thing may be trivial.

When I make a table of data i have the situation as on the first picture (multiple rows for different values in the column)

Mace_2-1640256118209.png

and would want to have it as on the second picture (one row and multiple columns-predefined).

Mace_3-1640258173965.png

 

I've tried to use "New Group" but couldnt adjust it.

Mace

1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @Mace 

Dax code, create 3 columns,

test1 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="DIST"))>0,"DIST")
test2 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="EMS"))>0,"EMS")
test3 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="OEM"))>0,"OEM")

result

vxiaotang_0-1640594125419.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

8 REPLIES 8
v-xiaotang
Community Support
Community Support

Hi @Mace 

Dax code, create 3 columns,

test1 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="DIST"))>0,"DIST")
test2 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="EMS"))>0,"EMS")
test3 = IF(CALCULATE(COUNT('Table'[CHANNEL]),FILTER(ALLEXCEPT('Table','Table'[MFG_P],'Table'[PART_NUMBER]),'Table'[CHANNEL]="OEM"))>0,"OEM")

result

vxiaotang_0-1640594125419.png

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

Samarth_18
Community Champion
Community Champion

Hi @Mace ,

 

You can create a column with below code:-

channel_dist = if(table[channel]="DIST",table[channel])
channel_ems = if(table[channel]="EMS",table[channel])
channel_oem = if(table[channel]="OEM",table[channel])

 

Thanks,

Samarth

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

@Samarth_18 , but would i loos the unnecessary rows?

Samarth_18
Community Champion
Community Champion

@Mace , In that case you can create a column in Edit query and remove unneccesary column after there.

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

@Samarth_18I want to create this table from company dataset and create live charts. I don't want to edit the table every time.

Samarth_18
Community Champion
Community Champion

@Mace  its a one time step only. 🙂

Best Regards,
Samarth

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
Connect on Linkedin

@Samarth_18 Oh, I see what you mean (sry too newbie), let me try.

amitchandak
Super User
Super User

@Mace , One way is to unpivot the data in power query

https://radacad.com/pivot-and-unpivot-with-power-bi

 

Second is channel as column in matrix visual

 

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.