Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Dear PowerBI Community,
I would like to know how to find the count of a visual table?
Lets imagine Table A
ID |
1 |
2 |
3 |
4 |
5 |
And Table B
Parameter |
A |
B |
C |
D |
E |
F |
When I create a visual table I filter based on ID I obtain:
ID | Parameter |
1 | A |
1 | B |
1 | C |
How can I count the rows in this visual table. I tried the Calculate(CountRows(TableA,Filtered by the ID selection ) however it doesn't work because it will give me only one row. If i try to do for the table B, it will give me the count of everything in the Table B.
Thank you
Solved! Go to Solution.
Hi, @Anonymous
I think I understand what you mean and I create a sample.
When there are duplicate rows in Table B, the above-mentioned problems will occur.
And you just need to use the distinctcount function.
Like this:
Measure 2 = DISTINCTCOUNT(TableB[Parameter])
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
Best Regards,
Community Support Team _ Janey
Hi, @Anonymous
I think I understand what you mean and I create a sample.
When there are duplicate rows in Table B, the above-mentioned problems will occur.
And you just need to use the distinctcount function.
Like this:
Measure 2 = DISTINCTCOUNT(TableB[Parameter])
Did I answer your question ? Please mark my reply as solution. Thank you very much.
If not, please feel free to ask me.
Best Regards,
Community Support Team _ Janey
@Anonymous the following doesn't make sense, based on your sample data, if you filter on ID 1 in Table a, you should get only two rows (A and ), not sure why you are getting B and C
This visual table looks like:
ID ( from table A) | param( from table B) |
1 | A |
1 | B |
1 | D |
1 | C |
You can add following measure, not sure if this is what you are looking for:
Count =
DISTINCTCOUNT ( TableB[ID] ) + DISTINCTCOUNT ( TableB[Parameter] )
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@Anonymous Not fully sure what you are actually looking for. Can you throw sample pbix file and the expected output. Seems like something very simple is missing here. In your original post you never explained how these tables are connected and I think I might be missing other things as well.
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
So I have Table A connected to Table B. Table A to B is connected with One to Many , both filtering.
Table A has a set of ID's. Table B has a set of ID's as well and Parameters Codes.
Table A:
ID |
1 |
2 |
3 |
4 |
5 |
Table B, has too those ID's and next to the ID there is a parameter.
ID | Parameter |
1 | A |
2 | B |
3 | C |
3 | A |
1 | D |
2 | C |
When I build a visual table with the ID from table A, and the parameter of Table B , and I choose a value of an ID from table A in a slicer I get a Visual table.
This visual table looks like:
ID ( from table A) | param( from table B) |
1 | A |
1 | B |
1 | D |
1 | C |
This table displays distinct values, for example if ID 1, is repeated with the same parameter it will show it once.
If i use the countrows of table B, it will show me the rows yes.
But the problem comes now: I unselect the slicer and I want to count the total rows of the visual table.
For example:
ID( from table A) | Parameter ( From table B) |
1 | A |
1 | C |
2 | A |
2 | D |
3 | A |
3 | b |
1 | D |
If i count the table B, it will show me the count of parameters used ( here they are A,B,C,D ) therefore 4, and if i choose table A, it will show me the count of the ID which are 3 here.
However I am looking for the count of rows of this visual table. ( here its 7)
@Anonymous just simply add a measure
Count = COUNTROWS ( 'Table B' )
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
This doesn't work, it will count the distinct count of rows, however the visual table will filter it
@Anonymous how these tables are related? What is your expected output?
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
Table A - (1 to many, both filterings)- Table B
I would like to display the count rows of the Visual Table ( the combination of the ID and Parameter) as shown above, after filtering the ID with a slicer.
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
80 | |
64 | |
57 |
User | Count |
---|---|
145 | |
111 | |
92 | |
84 | |
66 |