Forum Discussion
Row count problem in table
- 1 year ago
Hi Anonymous , Thank you for reaching out to the Microsoft Community Forum.
When you create a table visual in Power BI by dragging fields like [Run_Date] into the canvas, you're not creating a new data table, you're just displaying rows from an existing table in your data model. To write DAX that references that data, you need to use the name of the original table from which [Run_Date] comes. You can find this name in the Fields pane on the right side of Power BI Desktop. If you're still not sure, switch to the Model view and find the table that includes the [Run_Date] column.
If you already have calculated columns like [year_extracted] and [month_extracted], try below example measure:
CountFilteredRows =
CALCULATE(
COUNTROWS('RunData'),
'RunData'[year_extracted] = 2024,
'RunData'[month_extracted] = 2
)
If extracted columns aren’t needed, use DAX Directly with the Date Column. Example:
CountFilteredRows =
CALCULATE(
COUNTROWS('RunData'),
YEAR('RunData'[Run_Date]) = 2024,
MONTH('RunData'[Run_Date]) = 2
)
Once you create the measure, it will appear in the Fields pane under the 'RunData' table. You can drag it into a Card, Bar chart or any other visual to show or compare the row count.
Please refer below documentation:
Transform, shape, and model data in Power BI
Create measures for data analysis in Power BI Desktop
If this helped solve the issue, please consider marking it 'Accept as Solution' so others with similar queries may find it more easily. If not, please share the details, always happy to help.
Thank you.
Hi Anonymous
Can you please try the steps below?
Create a measure using DAX below.
Count_Filtered =
CALCULATE(
COUNTROWS(YourTableName),
YourTableName[month_extracted] = 2,
YourTableName[year_extracted] = 2024
)
If this answers your questions, kindly accept it as a solution and give kudos.