Forum Discussion

gracie494's avatar
gracie494
Icon for Helper I rankHelper I
5 years ago
Solved

Dax - Count in Column based on a specific field

Hello, How do I perform a count of the Cons group in each specific reporting unit. The output I am trying to achieve is in green:

 

  • gracie494 

    pls add all(), and have a try on below DAX.

    calculate(distinctcount[consgroup],filter(ALL(table),[reportingunit]=max([reportingunit]))

9 Replies

  • gracie494 , Try

    a New column

    = calculate(distinctcount(Table[ConsGroup]), filter(Table, [ reporting unit] =earlier([ reporting unit])))

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

    gracie494 Perhaps:

    Measure =
      VAR __RU = MAX('Table'[Reporting Unit])
      VAR __CG = MAX('Table'[ConsGroup])
    RETURN
      COUNTROWS(FILTER(ALL('Table'),[Reporting Unit]=__RU && [ConsGroup]=__CG))
  • gracie494 

    maybe try

    calculate(distinctcount[consgroup],filter(table,[reportingunit]=max([reportingunit]))

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

        gracie494 

        pls add all(), and have a try on below DAX.

        calculate(distinctcount[consgroup],filter(ALL(table),[reportingunit]=max([reportingunit]))