Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello everyone,
I have a problem and don't know how to proceed.
I have several tables. For each table (table 1 and 2) I would like to count the number of distinct values in column "Value":
Table1 --> Number of distinct values = 2
ID | Value |
1 | xyz |
5 | xyz |
12 | abc |
Table 2 --> Number of distinct values = 3
ID | Value |
2 | abc |
4 | def |
10 | ghi |
Based on this I would like to create a new table containing a list of the number of the distinct values for each table:
New table
Table | Number of distinct values |
Table 1 | 2 |
Table 2 | 3 |
I hope someone can help. Thanks in advance!
Solved! Go to Solution.
Hi @Anonymous
Try this code to create a new table:
Count Table =
UNION (
SUMMARIZE (
'Table 1',
"Table", "Table 1",
"Number of distinct values", DISTINCTCOUNT ( 'Table 1'[Value] )
),
SUMMARIZE (
'Table 2',
"Table", "Table 2",
"Number of distinct values", DISTINCTCOUNT ( 'Table 2'[Value] )
)
)
Output:
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your Kudos !!
Hi @Anonymous
Try this code to create a new table:
Count Table =
UNION (
SUMMARIZE (
'Table 1',
"Table", "Table 1",
"Number of distinct values", DISTINCTCOUNT ( 'Table 1'[Value] )
),
SUMMARIZE (
'Table 2',
"Table", "Table 2",
"Number of distinct values", DISTINCTCOUNT ( 'Table 2'[Value] )
)
)
Output:
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Appreciate your Kudos !!
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
55 | |
54 | |
54 | |
37 | |
29 |
User | Count |
---|---|
77 | |
62 | |
45 | |
40 | |
40 |