Forum Discussion

k3rz0rg's avatar
k3rz0rg
Icon for Advocate III rankAdvocate III
4 years ago
Solved

Need help with DAX condition.

Hi everyone,

 

I have a table with a title column and I needed a YES or NO return if all the conditions matches.

For example:

If Title is AAA and BBB and CCC (all 3 or 4 or more matches) then only return Yes, if not then NO (any 1 missmatch will return NO).

Could you please tell me how to do this with DAX? Custom Column or Measure anything? I tried with IF with AND function but no avail, maybe I was doing something wrong!

 

Thanks!

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi k3rz0rg ,

    Please refer to my obix file to see if it helps you.

    Create a measure.

    Measure = VAR _COUNTTITLE= CALCULATE(DISTINCTCOUNT('Table'[Title]),FILTER(ALL('Table'),'Table'[ID]=SELECTEDVALUE('Table'[ID])))
    RETURN 
    IF(_COUNTTITLE>=3,"YES","NO")

    Or a column.

    column = VAR _COUNTTITLE= CALCULATE(DISTINCTCOUNT('Table'[Title]),FILTER(('Table'),'Table'[ID]=EARLIER('Table'[ID])))
    RETURN 
    IF(_COUNTTITLE>=3,"YES","NO")

    Best Regards

    Community Support Team _ Polly

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

2 Replies

  • k3rz0rg , Try a new column like

     

    new column =
    var _1 = countx(filter(Table, Table[Title] = earlier(Table[Title]) && Table[Done] = "No") , Table[Title])
    return
    if(isblank(_1), "No", "Yes")

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi k3rz0rg ,

    Please refer to my obix file to see if it helps you.

    Create a measure.

    Measure = VAR _COUNTTITLE= CALCULATE(DISTINCTCOUNT('Table'[Title]),FILTER(ALL('Table'),'Table'[ID]=SELECTEDVALUE('Table'[ID])))
    RETURN 
    IF(_COUNTTITLE>=3,"YES","NO")

    Or a column.

    column = VAR _COUNTTITLE= CALCULATE(DISTINCTCOUNT('Table'[Title]),FILTER(('Table'),'Table'[ID]=EARLIER('Table'[ID])))
    RETURN 
    IF(_COUNTTITLE>=3,"YES","NO")

    Best Regards

    Community Support Team _ Polly

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.