Forum Discussion

DanielAlton's avatar
DanielAlton
New Member
1 year ago
Solved

DAX AND FILTERING

Hi all - can anyone help me with this problem?

 

I'm trying to get some dynamic filtering working on this, is my DAX incorrect? Doesnt seem to work for me

 

FilterByFunction = 

VAR SelectedFunction = SELECTEDVALUE('FBS MAP'[FunctionRef])

VAR MatchedTasks = FILTER('Tasks', 'Tasks'[FunctionRef] = SelectedFunction)

RETURN IF('Maps'[CHID] IN VALUES('MatchedTasks'[CHID]),"Match","No Match")

 

Thanks for any assitance!

 

  • Hi DanielAlton ,

     

    The FILTER syntax returns a table in this case since you are doing the full table you are getting more than one column you need to do something similar to this:

     

    FilterByFunction = 
    
    VAR SelectedFunction = SELECTEDVALUE('FBS MAP'[FunctionRef])
    
    VAR MatchedTasks = SELECTCOLUMNS(FILTER('Tasks', 'Tasks'[FunctionRef] = SelectedFunction), "CHID",'MatchedTasks'[CHID])
    
    RETURN IF('Maps'[CHID] IN MatchedTasks,"Match","No Match")

4 Replies

  • Hi DanielAlton ,

     

    The FILTER syntax returns a table in this case since you are doing the full table you are getting more than one column you need to do something similar to this:

     

    FilterByFunction = 
    
    VAR SelectedFunction = SELECTEDVALUE('FBS MAP'[FunctionRef])
    
    VAR MatchedTasks = SELECTCOLUMNS(FILTER('Tasks', 'Tasks'[FunctionRef] = SelectedFunction), "CHID",'MatchedTasks'[CHID])
    
    RETURN IF('Maps'[CHID] IN MatchedTasks,"Match","No Match")
  • v-pnaroju-msft's avatar
    v-pnaroju-msft
    Community Support

    Thank you, MFelixfor your response.

     

    Hi DanielAlton,

     

    We would like to check if the solution provided by MFelixhas resolved your issue. If you have found an alternative approach, we encourage you to share it with the community to assist others facing similar challenges.

    If you found the response helpful, please mark it as the accepted solution and add kudos. This recognition benefits other members seeking solutions to similar queries.

     

    Thank you.

  • v-pnaroju-msft's avatar
    v-pnaroju-msft
    Community Support

    Hi DanielAlton,

    We wanted to check in regarding your query, as we have not heard back from you. If you have resolved the issue, sharing the solution with the community would be greatly appreciated and could help others encountering similar challenges.

    If you found our response useful, kindly mark it as the accepted solution and provide kudos to guide other members.

    Thank you.

  • v-pnaroju-msft's avatar
    v-pnaroju-msft
    Community Support

    Hi DanielAlton,

    We are following up to see if your query has been resolved. Should you have identified a solution, we kindly request you to share it with the community to assist others facing similar issues.

    If our response was helpful, please mark it as the accepted solution and provide kudos, as this helps the broader community.

    Thank you.