Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Row count problem in table

Hi   I have a powerbi page that has some page level filters applied to it, so all data on the page is already filtered.   What I have done is clicked on "Table" under visualizations to created a ...
  • v-hashadapu's avatar
    v-hashadapu
    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.