Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
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 1 | Count Name 1 | Name 2 | Count Name 2 | Name 3 | Count Name 3 | |
| Abc | Def | 1 | Fgh | 1 | ||
| Def | Fgh | 1 | Abc | 1 | ||
| Abc | 1 | Abc | 1 | Abc | 1 | |
| def | 1 | Abc | Xyz | 1 | ||
| Ghi | 1 | Def | GhI | 1 |
I am trying to show names and there count of null as shown in below table.
| Name | Count |
| Abc | 4 |
| Def | 2 |
| Ghi | 2 |
| Xyz | 1 |
I tried Unpivot but it didnt pick value from other columns.
Thanks for your help.
Solved! Go to Solution.
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)
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:
Then we just need to put the fields on the visual and we can meet your need:
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
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)
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:
Then we just need to put the fields on the visual and we can meet your need:
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
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 44 | |
| 43 | |
| 38 | |
| 18 | |
| 16 |
| User | Count |
|---|---|
| 67 | |
| 63 | |
| 30 | |
| 30 | |
| 23 |