Forum Discussion

renatoremondi's avatar
renatoremondi
New Member
5 years ago
Solved

How to count RESULST OF a measure

Hello Guys,

I Want to count the results of my measure, but i don't now how., i need to know how much products i have in each classification.

The measure basically classifies the results of differences between two dates.

test =

var vDataHoje = TODAY()
var vDataPrevista = MAX(V_BV_GESTAO_TOUROS[DT_PREVENTCOL])
var vDataDif = DATEDIFF(vDataHoje,vDataPrevista,DAY)
var Classifica =

IF(vDataDif < 0 , "> 40 Dias Quarent.",
IF(AND(vDataDif >= 0 , vDataDif <= 7), "00 - 07",
IF(AND(vDataDif > 7 , vDataDif <= 15), "07 - 15",
IF(AND(vDataDif > 15 , vDataDif <= 21), "15 - 21","> 21 Dias"))))

Return
Classifica
  • renatoremondi So, in general you would do something along the lines of this:

    Zero to Seven = 
      VAR __Table = ADDCOLUMNS(SELECTCOLUMNS('Table',"__ProductID",[ProductID]),"__Class",[test])
    RETURN
      COUNTROWS(FILTER(__Table,[__Class] = "00-07"))

     Hard to be more specific without sample data.

     

3 Replies

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

    renatoremondi So, in general you would do something along the lines of this:

    Zero to Seven = 
      VAR __Table = ADDCOLUMNS(SELECTCOLUMNS('Table',"__ProductID",[ProductID]),"__Class",[test])
    RETURN
      COUNTROWS(FILTER(__Table,[__Class] = "00-07"))

     Hard to be more specific without sample data.