Forum Discussion
NilR
4 years agoPost Patron
DAX Max Function with multiple conditions
Question to answer: If John in zip code group 0 between 202001 and 202004 has ever voted? This is how I would right in sql but i need a measure in DAX to use the Y or N result in another me...
- Anonymous4 years ago
HI NilR,
You can try to use follow measure formula to get the count of vote rows based on the current 'zip' and 'member' group of a specific year range:
measure = VAR voteCount = CALCULATE ( COUNTROWS ( Table ), FILTER ( ALLSELECTED ( Table ), [Vote] = "Y" && AND ( [INC Year] >= 202001, [INC Year] <= 202004 ) ), VALUES ( Table[Zip_Code] ), VALUE ( Table[Member] ) ) RETURN IF ( voteCount > 0, "Y", "N" )Regards,
Xiaoxin Sheng
Anonymous
4 years agoNot applicable
HI NilR,
You can try to use follow measure formula to get the count of vote rows based on the current 'zip' and 'member' group of a specific year range:
measure =
VAR voteCount =
CALCULATE (
COUNTROWS ( Table ),
FILTER (
ALLSELECTED ( Table ),
[Vote] = "Y"
&& AND ( [INC Year] >= 202001, [INC Year] <= 202004 )
),
VALUES ( Table[Zip_Code] ),
VALUE ( Table[Member] )
)
RETURN
IF ( voteCount > 0, "Y", "N" )
Regards,
Xiaoxin Sheng