Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Measure for countrows is not returning accurate count

All, I am using countrows function to calculate count of rows where status field value is 'Late', see screenshot below. 

Here is the measure formula I am using: 

COUNTROWS(FILTER('ReceiptData withPOLines','ReceiptData withPOLines'[Status]="Late")), just fyi status is a text field. 
 
However, the measure count seems off, when I put a card visual and add measure on it, it shows below. IDeally the count should be 2 instead of 4, so it looks like something is off. Is my formula not accurate? Please assist, thanks in advance. 

 

5 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    To dig deeper into this, I added a column called latecount with the formula: GilbertQ 

    if('ReceiptData withPOLines'[Status]="Late",1,0) and  got to know what is going off here. See screenshot below. 

     


     

     Ideally if the status value is late then it should log 1 in latecount field but its doing something else, that is where the discrepancy is coming up. When I do 'dont summarize' for latecount field then it gives me 1 for all late values. No other filters are in place.

     

    • GilbertQ's avatar
      GilbertQ
      Icon for Super User rankSuper User

      Hi Anonymous 

       

      Without having your actual data there is certainly something going on with the Status column causing this to not work as expected.

  • Hi Anonymous 

     

    Can you try the following measure and see if this works?

    If you can also make sure that there is no white space before or after the Status?

     

    Total Receipts = CALCULATE(COUNTROWS('ReceiptData withPOLines'),'ReceiptData withPOLines'[Status]="Late")
    • Anonymous's avatar
      Anonymous
      Not applicable

      GilbertQ Thanks so much for your response. I tried the same but the count is still off, thoughts?

      • GilbertQ's avatar
        GilbertQ
        Icon for Super User rankSuper User

        Hi Anonymous 

         

        Can you confirm there are no other filters on your page?