Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago
Solved

DAX Quarter

Hi Guys ,

I have a data per empolyee each quarter with total number of contribution column .. I wan to create a column to check wether the total number of contirbution is > 11 for each empolyee per Quarter.. can you please help on that  ?

 

 

  • Anonymous Hard to be specific without sample data but probably something like:

    Measure =
      VAR __Employee = MAX('Table'[Employee])
      VAR __Quarter = MAX('Table'[Quarter])
      VAR __Table = FILTER(ALL('Table'),[Employee]=__Employee && [Quarter]=__Quarter)
    RETURN
      IF(COUNTROWS(__Table)>11,1,0)

4 Replies

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

    Anonymous Hard to be specific without sample data but probably something like:

    Measure =
      VAR __Employee = MAX('Table'[Employee])
      VAR __Quarter = MAX('Table'[Quarter])
      VAR __Table = FILTER(ALL('Table'),[Employee]=__Employee && [Quarter]=__Quarter)
    RETURN
      IF(COUNTROWS(__Table)>11,1,0)
  • Anonymous's avatar
    Anonymous
    Not applicable

    Greg_Deckler sorry for my late reply , but what if Quarter & Empolyee is in 2 different data tables and tables are connected by relationship already .. 

     VAR __Table = FILTER(ALL('Table'),[Employee]=__Employee && [Quarter]=__Quarter

     in the above line it is assuming that 'Table' is the same , that's how Filter Function works , but actually Quarter & Empolyee Columns are in different tables .. so How can we adapt the measure then ? .. Thanks in Advance 

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

      Anonymous Use CALCULATETABLE for that, this allows you to apply a filter from a related table or even use TREATAS.

  • Anonymous's avatar
    Anonymous
    Not applicable

    Greg_Deckler .. Thanks it workd with Calculatetable 🙂