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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
AnkurSharma
Helper I
Helper I

Count from multiple columns.

Hi Everyone,

I am trying to show Distinct names and there count in table . 

Task is to show names and there count in three columns, It is possible name appears in all three column then count will be 3. If its blank then Ignore. 

 As shown in below example:

This is how my data looks like.

Name 1Count Name 1Name 2Count Name 2Name 3Count Name 3 
Abc Def1Fgh1 
Def Fgh1Abc1 
Abc1Abc1Abc1 
def1Abc Xyz1 
Ghi1Def GhI1 

 

I am trying to show names and there count of null as shown in below table.

NameCount
Abc4
Def2
Ghi2
Xyz1

 

 

I tried Unpivot but it didnt pick value from other columns.

Thanks for your help.

 

1 ACCEPTED SOLUTION
v-yueyunzh-msft
Community Support
Community Support

Hi , @AnkurSharma 

Accoridng to your description, you want to "Count from multiple columns".

Here are the steps you can refer to :

(1)My test data is the same as yours.

(2)You can add a step after the previous steps in Power Query Editor (Insert Step After)

vyueyunzhmsft_0-1677204263625.png

And then you can put this code in it:

= Table.SelectColumns(#"Changed Type",{"Name 1","Count Name 1"}) & 
 Table.RenameColumns(Table.SelectColumns(#"Changed Type",{"Name 2","Count Name 2"}),{{"Name 2", "Name 1"},{"Count Name 2", "Count Name 1"}})  & 
Table.RenameColumns(Table.SelectColumns(#"Changed Type",{"Name 3","Count Name 3"}),{{"Name 3", "Name 1"},{"Count Name 3", "Count Name 1"}})

Then we can get the table like this:

vyueyunzhmsft_1-1677204320332.png

Then we just need to put the fields  on the visual and we can meet your need:

vyueyunzhmsft_2-1677204337666.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

View solution in original post

2 REPLIES 2
v-yueyunzh-msft
Community Support
Community Support

Hi , @AnkurSharma 

Accoridng to your description, you want to "Count from multiple columns".

Here are the steps you can refer to :

(1)My test data is the same as yours.

(2)You can add a step after the previous steps in Power Query Editor (Insert Step After)

vyueyunzhmsft_0-1677204263625.png

And then you can put this code in it:

= Table.SelectColumns(#"Changed Type",{"Name 1","Count Name 1"}) & 
 Table.RenameColumns(Table.SelectColumns(#"Changed Type",{"Name 2","Count Name 2"}),{{"Name 2", "Name 1"},{"Count Name 2", "Count Name 1"}})  & 
Table.RenameColumns(Table.SelectColumns(#"Changed Type",{"Name 3","Count Name 3"}),{{"Name 3", "Name 1"},{"Count Name 3", "Count Name 1"}})

Then we can get the table like this:

vyueyunzhmsft_1-1677204320332.png

Then we just need to put the fields  on the visual and we can meet your need:

vyueyunzhmsft_2-1677204337666.png

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

Thanks Aniya Zhang

Helpful resources

Announcements
October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors