Forum Discussion

pbi_data's avatar
pbi_data
Frequent Visitor
3 years ago

Filter text in Power Bi using DAX

Hi,

Can you help me how to create a table B from table A using DAX that includes only rows for customer id's that contain only the string price w/o th word standard. IS it helpful to use the NOT(CONTAINSSTRING) function here?

 

table A

idtext
111standard price for the product
112standard for the product
113 price for the product

 

table B

 

idtext
113 price for the product

 

Any assistance would be helpful.

 

Thank you.

3 Replies

  • Hi pbi_data 
    Excatly, you can use NOT(CONTAINSSTRING) to create your calculated table as below

     

    NewTable = 
    SUMMARIZE(
    FILTER(
    'OriginalTable',
    NOT(CONTAINSSTRING('OriginalTable'[text],"standard")))
    ,'OriginalTable'[id],
    'OriginalTable'[text])

    Did it work ? 👍 A kudos would be appreciated ‌‌📢 Mark it as a solution to help spreading knowledge

  • pbi_data's avatar
    pbi_data
    Frequent Visitor

    Thank you so much,it works.

    In addition to this, I need some more help. I want to display in in one table visuals the following result: show only customer_ids that satisfy this condition: if there is a row with the text 'Non ref replaced' and for the same customer a row 'Standard price', show only this row 10000 Non Ref replaced.

    In other table visual : if there is only Non Ref or NonRef and no other values in Key words column show only the custmer id only once.

    customer_idKeyWords
    10000Standard Price
    10000Non Ref
    10000Non Ref replaced
    10000NonRef

     

    Any assistance would be appreciated.

    • DataVitalizer's avatar
      DataVitalizer
      Super User

      I need to understand more the new request.

      In case you have the above example, customer_id 10000 with the four keywords, can you tell me what is the value to prioritize, something like this:

      customer_idKeyWords 
      10000Standard Price3
      10000Non Ref1?
      10000Non Ref replaced2
      10000NonRef1?


      Did it work 👍 A kudos would be appreciated ‌‌📢 Mark it as a solution to help spreading knowledge