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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
tj1947
Regular Visitor

DAX COUNTROWS is overcounting and MEASURE COUNTROWS is undercounting AAAAARG!!

I have a table with three rows

serialnumber          Actual Ship Date     SchedShip           On Time
211028-23-M34     2024-02-27             2024-02-27         1
211027-23-M34     2024-02-27             2024-02-28         1
220224-12-M11     2024-02-28             2024-02-23         0

tj1947_0-1709157600856.png

 

I'm trying to get DAX or a MEASURE to return the correct rowcount.

 

The Measure below returns "2"
     COUNTROWS('On Time Delivery')   
tj1947_1-1709157756466.png

 

The DAX Column below returns "6"
    COUNTROWS('On Time Delivery') 
 
I have also tried COUNT('On Time Delivery'[SerialNumber]
I have also tried COUNT(DISTINCT('On Time Delivery'[SerialNumber]))
 
Nothing returns "3" which is what I'm expecting.
1 ACCEPTED SOLUTION
v-yaningy-msft
Community Support
Community Support

Hi, @tj1947 

 

Based on your description, I have created some measures to achieve the effect you are looking for. Following picture shows the effect of the display.

 

vyaningymsft_0-1709199547151.png

Measure:

 

COUNTROWS = CALCULATE(COUNTROWS('On Time Delivery'))

 

 

vyaningymsft_1-1709199677825.png

If this does not work, I observe that your table has its own filters and Measure, and it may be that these filters are affecting the final realization; you can provide your own data in full and the effect you want to achieve.


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

 

 

View solution in original post

3 REPLIES 3
v-yaningy-msft
Community Support
Community Support

Hi, @tj1947 

 

Based on your description, I have created some measures to achieve the effect you are looking for. Following picture shows the effect of the display.

 

vyaningymsft_0-1709199547151.png

Measure:

 

COUNTROWS = CALCULATE(COUNTROWS('On Time Delivery'))

 

 

vyaningymsft_1-1709199677825.png

If this does not work, I observe that your table has its own filters and Measure, and it may be that these filters are affecting the final realization; you can provide your own data in full and the effect you want to achieve.


Best Regards,
Yang
Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly.
If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

 

 

selimovd
Super User
Super User

Hey @tj1947 ,

 

what do you event want to do?

If you use filter or slicer, the table will be filtered. Then the rowcount is less.

 

How did you even get 6 when there are only 3 rows?

Please provide a sample file or at least more context. Like this I don't think anyone can help you.

 

Best regards

Denis

I was trying to get an accurate count of the rows.  I have no idea how/why it was returning 6 when there were only 3 rows, hence my confusion and posting here for help.  

 

No worries, though!   v-yaningy-msft was able to help.  Adding CALCULATE to my COUNTROWS measure worked like a charm.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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