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

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.

Reply
Anonymous
Not applicable

Count Visual Table Rows

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:

 

IDParameter
1A
1B
1C

 

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

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

Hi, @Anonymous 

 

vjaneygmsft_4-1639385640152.png

 

vjaneygmsft_2-1639385600165.png

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. 

vjaneygmsft_3-1639385613273.png

And you just need to use the distinctcount function.

Like this:

 

Measure 2 = DISTINCTCOUNT(TableB[Parameter])

 

  

vjaneygmsft_5-1639385846285.png

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

View solution in original post

8 REPLIES 8
v-janeyg-msft
Community Support
Community Support

Hi, @Anonymous 

 

vjaneygmsft_4-1639385640152.png

 

vjaneygmsft_2-1639385600165.png

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. 

vjaneygmsft_3-1639385613273.png

And you just need to use the distinctcount function.

Like this:

 

Measure 2 = DISTINCTCOUNT(TableB[Parameter])

 

  

vjaneygmsft_5-1639385846285.png

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

parry2k
Super User
Super User

@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.

parry2k
Super User
Super User

@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.

Anonymous
Not applicable

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.

IDParameter
1A
2B
3C
3A
1D
2C

 

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)
1A
1B
1D
1C

 

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)
1A
1C
2A
2D
3A
3b
1D

 

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)

parry2k
Super User
Super User

@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.

Anonymous
Not applicable

This doesn't work, it will count the distinct count of rows, however the visual table will filter it

parry2k
Super User
Super User

@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.

Anonymous
Not applicable

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.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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