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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
steen_p
Helper II
Helper II

How to get number of rows from a table visual

Hi,

 

I trying to figure out how I can create a measure that can show the number of rows in a table visual. 

I have made a simple measure like COUNTROWS('Tablename'), and that works ok as long as I just use the Page and Report filters, but when it comes to the Visual filters, it doesn't change the numbers. I assume it's because the visual filter is kind of done "within" the visual and therefore doesn't affect my measure. The question if then if it's possible to create a measure that works "inside" the visual so I can see the acual number of records in the visual - no matter where the filtering is done?

 

Sorry if this is a double post, but I doesn't find the one I posted for some hours ago.

 

Regards

Steen

3 REPLIES 3
V-lianl-msft
Community Support
Community Support

Hi @steen_p ,

 

I suspect that your data set is too large to cause calculation delay. When filtering at the visual level, maybe the calculation is frozen. Generally speaking, applying the same filter at three levels will not affect the results.

 

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

aj1973
Community Champion
Community Champion

Hi @steen_p 

In my understanding you want to count rows for a visual when a filter is selected! if so then you need to embed the Measure SLECTEDVALUE to your COUNTROWS.

 

It's not very clear your description maybe if you can share a Sample PBIX then we can help you better.

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Hi,

I'm not sure if SELECTEDVALUE will solve the problem, because it's not a specific selected value as such I'd like to count, but how many rows I have in a table visual.

 

And my existing measure that just does a COUNTROWS seems to do it ok as long as I use the filters for the Report and the Page, but it doesn't reflect the filtering im doing on the visual. 

So I'm looking for a way to do this? The reason is that my users are exporting data to Excel from  this table and since Power BI are limited to export 150.000 rows I need to have a measure showing how many rows I have in the table with the different filters set. 

Maybe it doesn't have to be a measure or a count, but I just can't figure out any other way yo get this number.

 

In another reply., I also go the suggetion to use SUMMARIZECOLUMNS and then COUNTROWS but for some reason I can't get that measure to work at all.

Rgiht now my measure is - 


No of Rows in selection =
COUNTROWS(
SUMMARIZECOLUMNS('TableName'[Column1], 'TableName'[Column2]))

 

This one works when I test it in DAX Studio, but when I add it as a measure in my Power BI file, if gives me an error about "Calculation error im measure 'All Meassures'[No of Rows in selection]: SummarizeColumns and AddMissingItems() may not be used in this context."

I simply can't figure out what it wrong with it in Power BI, when it works in DAX Studio.

 

I'm still not sure if it will solve my problem though, because I could image that this wouldn't "see" the filtering on the visual either.

 

Regards

Steen

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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