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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
ScarlettBebb
Frequent Visitor

COUNTROWS Calculation not working for Multiple filters.

Hello, 

 

Thank you so much in advance if you response to this. I am trying to create a Count Rows column or Measure it doesn't matter which for this. I need to count the number of rows as a way of calucating the number of tested products/Lots per Month. I have a Date column called 'Attribute', A Product column, and a Lot column. This is an example of my Table. 

 

ProductLotAttributeVerdict
G111105-Jan-161
G111212-Feb-161
G111304-Mar-161
G111408-Apr-160
G111514-May-160
G111616-Jun-160
G111717-Jul-160
G111818-Aug-161
G111926-Sep-161
G222105-Jan-161
G222212-Feb-161
G222304-Mar-160
G222408-Apr-160
G222514-May-160
G222616-Jun-161
G222717-Jul-161
G222818-Aug-161
G222926-Sep-161
G333105-Jan-161
G333212-Feb-161
G333304-Mar-160
G333408-Apr-160
G333514-May-160
G333616-Jun-161
G333717-Jul-161
G333818-Aug-161
G333926-Sep-161

 

I am trying to caluclate the number of tested batches by Product and Lot over 1 month per year using this formula which is not working. 

 

Number of tested = COUNTROWS(
    FILTER('FPA data combined'),
    FILTER('FPA data combined'[Attribute],
    FILTER('FPA data combined'[Product ],
    FILTER('FPA data combined'[Lot]))
    ))
 
Thank you so much,
 
Scarlett
1 ACCEPTED SOLUTION
ERD
Community Champion
Community Champion

@ScarlettBebb , you can try this calculated column formula:

Column =
VAR product = 'Table'[Product]
VAR lot = 'Table'[Lot]
VAR month = MONTH ( 'Table'[Attribute] )
VAR year = YEAR ( 'Table'[Attribute] )
VAR t =
    FILTER (
        'Table',
        'Table'[Product] = product && 'Table'[Lot] = lot
            && MONTH ( 'Table'[Attribute] ) = month && YEAR ( 'Table'[Attribute] ) = year
    )
RETURN
    COUNTROWS ( t )

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

View solution in original post

4 REPLIES 4
ERD
Community Champion
Community Champion

Hi @ScarlettBebb , do you have a separate Date table in your model? What are you trying to filter?

 

ERD_0-1693306352436.png

Measure = COUNTROWS('Table')

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

Hello @ERD I have a date column in table. I am trying to count the numbers of Products tested per month so I have filtered 'Product' and the 'Lot' and then was trying the filter 'Date to 1 month'. So my new column should look like the one below 'Numbers Tested'. 

 

ProductLotAttributeVerdictNumbers Tested
G111105-Jan-1611
G111212-Feb-1611
G111304-Mar-1611
G111408-Apr-1601
G111514-May-1601
G111616-Jun-1601
G111717-Jul-1601
G111818-Aug-1611
G111926-Sep-1611
G222105-Jan-1611
G222212-Feb-1611
G222304-Mar-1601
G222408-Apr-1601
G222514-May-1601
G222616-Jun-1611
G222717-Jul-1611
G222818-Aug-1611
G222926-Sep-1611
G333105-Jan-1611
G333212-Feb-1611
G333304-Mar-1601
G333408-Apr-1601
G333514-May-1601
G333616-Jun-1611
G333717-Jul-1611
G333818-Aug-1611
G333926-Sep-1611
ERD
Community Champion
Community Champion

@ScarlettBebb , you can try this calculated column formula:

Column =
VAR product = 'Table'[Product]
VAR lot = 'Table'[Lot]
VAR month = MONTH ( 'Table'[Attribute] )
VAR year = YEAR ( 'Table'[Attribute] )
VAR t =
    FILTER (
        'Table',
        'Table'[Product] = product && 'Table'[Lot] = lot
            && MONTH ( 'Table'[Attribute] ) = month && YEAR ( 'Table'[Attribute] ) = year
    )
RETURN
    COUNTROWS ( t )

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. Appreciate your Kudos.

Check out my latest demo report in the data story gallery.

Stand with Ukraine!


Here are official ways you can support Ukraine financially (accounts with multiple currencies):
1) Support the Armed Forces of Ukraine: https://bank.gov.ua/ua/about/support-the-armed-forces
2) Come Back Alive foundation: https://www.comebackalive.in.ua/

Thank you!

@ERD Thank you so much that worked perfectly 🙂

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.