Forum Discussion

android1's avatar
android1
Icon for Post Patron rankPost Patron
9 years ago

Count Columns that don't contain zero

Hi,

 

Trying to count the number of weeks which have been invoiced.

In attached image, Week numbers are at the top (Wk 3 - 21).

 

The values (14.00, 17.50 etc are the column [Visits_NoHrs])

 

Trying this fromula ->

 

Num Invoiced Weeks = CALCULATE(COUNTA(vw_PivotVisitsInvoiced[Visits_NoHrs]),vw_PivotVisitsInvoiced[Visits_NoHrs] <> 0) but getting 1 for the example in attached. (expect 8)

 

Regards,

 

 

Gerry

12 Replies

  • vanessafvg's avatar
    vanessafvg
    Icon for Community Champion rankCommunity Champion

    android1

     

    wouldn't > 0 work better then <> 0?   i am assuming its a number?

     

    your example doesn't make sense to me, what should be 1 or shouldn't be?

     

    • android1's avatar
      android1
      Icon for Post Patron rankPost Patron

      Hi vanessafvg,

       

      >0 returns the same. Num Invoiced weeks should be 8 as there are 8 times (weeks) where [Visits_NoHrs] is not zero.

      I want to count the weeks where [Visits_NoHrs] <> 0.

       

      I get 1 rather than 8.

       

       

       

       

       

      • vanessafvg's avatar
        vanessafvg
        Icon for Community Champion rankCommunity Champion

         

        android1

        what does your data look like? can you post a screenshot?

         

        what if you tried something liek this 

        Num Invoiced Weeks = CALCULATE(countrows(vw_PivotVisitsInvoiced), not(isblank(vw_PivotVisitsInvoiced[Visits_NoHrs]))

         

        is the data blank or 0?