Forum Discussion

iamprajot's avatar
iamprajot
Responsive Resident
8 years ago

CountIf as CountAX

Hi, I am using this to count the repetition of CustomerID for each row

CALCULATE(COUNTROWS(Orders),ALLEXCEPT(Orders,Orders[CustomerID]))

 

Is it possible without Calculate to count the occurences of a String in a column and get the result in Column

Something like 

COUNTAX(Orders,ALLEXCEPT(Orders,Orders[CustomerID]))

5 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    Yes but you syntax is incorrect:

     

    COUNTAX(ALLEXCEPT(Orders,Orders[CustomerID]),[CustomerID])
    • Zubair_Muhammad's avatar
      Zubair_Muhammad
      Community Champion

      iamprajot

       

      I think using ALLEXCEPT as table expression in X - ITERATORs typically yields circular dependency error

       

      =
      COUNTAX (
          FILTER ( Orders, Orders[Customer ID] = EARLIER ( Orders[Customer ID] ) ),
          [Customer ID]
      )
      • iamprajot's avatar
        iamprajot
        Responsive Resident

        Zubair_Muhammad

        It's working but I looking for something based on just COUNTAX and ALLEXCEPT and no use of Filtering or Earlier or any other function.