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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
saviola07
Frequent Visitor

counting the rows in a table visual respecting slicers

Hi there,

 

I have tried searching for the answer in the archive for the following issue I have but didnt find anything that really could fix it so here goes:

 

My underlying data set consists of some million lines of sales data. To make it digestable for the end-users, I have made some reports with visuals etc. But I have also created a report that serves the need of them creating a table with the data they need so they can export it to Excel to conduct their own analyses. As there is a limit of 150k lines that can be exported to Excel, I need a "Card"-visual to show how many rows there are in the table they have created.

In this table, I haven't added all the columns that is part of the underlying data (this is a way to limit the amount of rows).

The idea is that by using around 10-15 slicers the end-user will be able to get the data they need and then export it.

To exemplify what I have done:

 

Here is how the underlying data could look like:

MonthDateClientProduct CategoryProduct TypeQuantity
101-01-2020ABBCCC1
102-01-2020ABBCCC1
201-02-2020ABBDDD1

 

Here is how my table in report looks like:

MonthClientProduct CategoryProduct TypeQuantity
1ABBCCC2
2ABBDDD1

 

If I use a count-measure, I will get a count of 3 in my report table as it will look at the underlying data set and not the new table.

 

So my question is how do I set up a row counter that takes into consideration the selection of slicer values that might be selected by the end-user and actually show the amount of rows in this table visual and not how many rows it would be if the table was formatted in the same way as the underlying data table?

 

(I am unable to share the data set as it is confidential stuff).

 

I hope the above makes sense and someone can help (I am a rookie in Powerbi!) 🙂

 

Best regards,

Dan

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @saviola07 

 

You can create a Measure like below.

Measure = 
COUNTROWS(
    GROUPBY(
        'Table',
        'Table'[Month],
        'Table'[Client],
        'Table'[Product Category],
        'Table'[Product Type]
    )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

View solution in original post

4 REPLIES 4
rainer1
Resolver III
Resolver III

Hi,

 

wich column do you want to count ?

Your report table looks like this because you leaf out the Date column then power bi wrap it together.

 

If you want to Count the distinct value of the Product type go to the Fields tab under Visualizations and set the Count to Count(Distinct).Then only the unique Value will counted.

 DistinctCount.png 

 

-------------------------------------------------------------------
Did I answer your question? Mark my post as a solution!
It was useful? Press Thumbs Up!

Mariusz
Community Champion
Community Champion

Hi @saviola07 

 

You can create a Measure like below.

Measure = 
COUNTROWS(
    GROUPBY(
        'Table',
        'Table'[Month],
        'Table'[Client],
        'Table'[Product Category],
        'Table'[Product Type]
    )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Hi Mariusz,

 

That almost works as a charm!

 

The table-visual is using parameters from different tables. For some reason, I am unable to add parameters from a specific table as a "group-by"-variable in the count-measure. This means that the "card-"visual is slightly underestimating the actual count. Do you have an idea of how to fix this?

 

BR,

Dan

Hi @saviola07 

 

if you list your fact table ( one with Many sides of the relationship ) as a first argument it should pick up all the filters coming from any tables on one side of the relationship.

 

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

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