Forum Discussion
Anonymous
4 years agoNot applicable
count rows with some conditions
Hi everyone! I need to count the rows with same idticket, idclient after the first time that they appear. I also have to exclude duplicates so I only have to count once these records. The result is ...
Jihwan_Kim
Super User
4 years agoHi,
I am not sure if I understood your question correctly, but please check the below picture and the attached pbix file.
It is for creating a measure.
test 2 fix =
SUMX (
'Table',
CALCULATE (
SWITCH (
TRUE (),
VAR currentidticket =
MAX ( 'Table'[idticket] )
VAR currentidclient =
MAX ( 'Table'[idclient] )
RETURN
MINX (
FILTER (
ALL ( 'Table' ),
'Table'[idticket] = currentidticket
&& 'Table'[idclient] = currentidclient
),
'Table'[Date_time]
)
= MAX ( 'Table'[Date_time] ), 0,
COUNTROWS ( 'Table' ) > 1, 1 / COUNTROWS ( 'Table' ),
1
)
)
)