Forum Discussion
Card with counter from Object Table
To create a card that dynamically counts the number of records visible in your **Table visual** (based on the active date and user filters), you can use DAX to create a measure that reflects the count of records in the context of the applied filters. Here’s how you can do it:
### Step-by-Step Solution
1. **Create a Measure for Counting Records**
Create a new measure that will count the rows in the table based on the current filter context.
```DAX
RecordCount = COUNTROWS('YourTable')
```
> Replace `'YourTable'` with the name of the main table used in the Table visual.
2. **Place the Measure in a Card Visual**
- Go to your **Report view** in Power BI.
- Insert a **Card visual**.
- Add the `RecordCount` measure to the Card.
This will display the total count of rows currently visible in the Table visual, respecting any filters applied through the **Date** and **User** slicers.
3. **Ensure Filters are Applied Correctly**
- Make sure that the Date and User filters are properly linked to the table in the data model.
- If the Date or User fields are from different tables, ensure that there is a relationship between them and your main table, so the filters can flow through and affect the `RecordCount` measure correctly.
### Alternative: Using a DISTINCTCOUNT if Needed
If you need to count unique values in a specific column rather than all rows, use `DISTINCTCOUNT` instead of `COUNTROWS`:
```DAX
UniqueRecordCount = DISTINCTCOUNT('YourTable'[YourColumn])
```
> Replace `'YourTable'[YourColumn]` with the relevant table and column.
This approach will allow your card to dynamically reflect the number of records displayed in the Table visual based on the filter context, giving you an accurate record count that updates with the filters.
If this solution brightened your path or made things easier, please consider giving kudos. Your recognition not only uplifts those who helped but inspires others to keep contributing for the good of our community!