Forum Discussion

Krishna1992's avatar
Krishna1992
Helper I
6 years ago
Solved

Filter based on criteria

Hello everyone,

 

I have 2 columns in my table, one is category and other is product.

 

I need to select/filter only required category based on product.

 

Something like below table,

ProductCategory
Juicewatermelon
JuicePinapple
Juicepapaya
JuiceApple
soapHamam
soaplifebouy
soapcinthol
powdersandal
powderchintoor
powderponds

 

So my required output is:

ProductCategory
Juicewatermelon
JuicePinapple
soapHamam
soaplifebouy
powdersandal

 

So I only required watermelon and pinapple when product = Juice.

 

Need to filter based on above criteria.

 

Thanks

  • az38's avatar
    az38
    6 years ago

    Krishna1992 

    could you do it manually?

    go to the Power Query Editor pick your table, add Custom column like

    = Text.Combine({[Location], "-", [Category]})

    then filter out all you don't need like in Excel

    do not hesitate to give a kudo to useful posts and mark solutions as solution

13 Replies

  • az38's avatar
    az38
    Community Champion

    Hi Krishna1992 

    whats scenario should be used? is it predefined filter? are you going to use a slicer?

    you could try the simpliest way is to filter in visuals or to create a calculated table

    Table = 
    FILTER(ALL('Table');
    'Table'[Product]="juice" && ('Table'[Category]="watermelon" || 'Table'[Category]="pinapple ")
    )

    do not hesitate to give a kudo to useful posts and mark solutions as solution

     

    • Krishna1992's avatar
      Krishna1992
      Helper I

      Hi az38,

      Can I filter these data from query editor itself instead of using DAX. I want data to be filtered before projecting in visuals. If I create DAX will that data be applicable for all visuals?

      • az38's avatar
        az38
        Community Champion

        Krishna1992 

        you could easily filter out suceedeed data in Power Query Editor like in Excel

        do not hesitate to give a kudo to useful posts and mark solutions as solution