1
votes

I know similarly named topics exist but I spent hours looking for the answer to something which i feel must be easy to do.

I have a table Visual in Power Bi and need to get a row count which would adjust as users set filters and use slicers. The columns in the table don't have one level of hierarchy (otherwise a measure with DISTINCTCOUNT would do the trick), see an image of my table - I need to count rows in this table (21).

My Table Visual

I couldn't find any way to directly refer to the Table Visual in DAX so simple COUNTROWS() wasn't useful. I tried to create a measure using various DAX expressions i found, e.g. recreate the table in DAX using CALCULATETABLE and have it use active filters, i failed there...

I also created an index variable on the physical/dataset table and tried to add it to the visual table and summarize it in some way (the column "Counter" in the table) - it didn't work, didn't give me the number of rows in the visual table but gave the number of rows in the physical/database table.

Please could you help me how to do this...

1
Not sure what the problem is... If you create a measure: COUTROWS(MyTable), will it not work for you?RADO
I am talking about a table visual, not the datatable. I dont know and couldnt find a way to refer to a table visual in DAXAlexander Fedotov

1 Answers

0
votes

You won't really be able to access the table visual in the way you're thinking, but as long as you know how it comes together, that should be just as good.

CountSummaryRows = 
CALCULATE(
    COUNTROWS(SUMMARIZE(Table1, Table1[A], Table1[B], Table1[C], Table1[D])), 
    ALL(Table1)
    )

This measure will aggregate to the level of your A,B,C,D columns, then count the total. ALL(Table1) just ensures you get the grand total, so every row should show as 21, but at least you'll have a handle on that summary table count.