Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Using PATHCONTAINS and SELECTEDVALUE

Hi,

I have an items table, and a product table.

In the product table I have a column where all the items required to build the product is listed in A_B_C fashion.


I have created a calculated column like below and tried to use this as a filter to show products which includes those items, but it did not work:

ItemRequired =

PATHCONTAINS ( 'ProductTable'[Items], SELECTEDVALUE ( 'ItemTable'[ItemID] ) ))

Ideally I would like to show ItemName to the user, and in the background will take the selected ItemID, match if that ID is present in Items column of the ProductTable, and want to show only the products those satisfiy this condition.

Can someone help me to point out the problem in this approach ?

Thanks.
  • Hi, Anonymous 

     

    You can try the following methods.

    Measure = 
    Var _N1=SEARCH(SELECTEDVALUE('Item'[ItemID]),SELECTEDVALUE('Product'[Items]),1,0)
    Return
    IF(_N1>0,1,0)

    Put measure in the filter of this view and set it equal to 1.

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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

3 Replies

  • v-zhangti's avatar
    v-zhangti
    Community Support

    Hi, Anonymous 

     

    You can try the following methods.

    Measure = 
    Var _N1=SEARCH(SELECTEDVALUE('Item'[ItemID]),SELECTEDVALUE('Product'[Items]),1,0)
    Return
    IF(_N1>0,1,0)

    Put measure in the filter of this view and set it equal to 1.

    Is this the result you expect?

     

    Best Regards,

    Community Support Team _Charlotte

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

    • Anonymous's avatar
      Anonymous
      Not applicable

      Thanks for that !
      Just wondering will it be possible to let the user choose the ItemName, instead of ItemID ?
      Thanks

    • Anonymous's avatar
      Anonymous
      Not applicable

      +Also wondering if I want to create a measure out of the Products, how do I apply this Item filtering ?