Forum Discussion

bansikpopat's avatar
bansikpopat
Frequent Visitor
3 years ago
Solved

Filtering 2 columns with different filter values in a table

I have created a table as below - 

The last two columns - Total stock and QN are calculated columns. They are summation of different columns. 

I have a requirement to filter these last two columns on different conditions. 

"Total stock" needs to be filtered on Storage location = 

  • 0010
  • 0020
  • MDD
  • MDR

"QN" needs to be filtered on Storage location = 

  • ATQN
  • GGQN
  • RQTF
  • AQTF
  • ASEG

Storage location is another column in the same table. 

I need to diplay this in the same table that I attached. I am trying to automate the work that is done in excel into powerBI. In excel, I could manually choose the necessary filters per column and was able to get the desired table. 

 

I tried checking Filter function but I was not able to get the desired results. Could anyone please help. 

 

Thank you. 

  • bansikpopat ,

    New columns

    Total Qty = Switch( True() ,

    [ Storage location] in {"0010","0020","MDD","MDR"} , [Confirmed Qty],

    blank()

    )

     

     

    QN = Switch( True() ,

    [ Storage location] in {"ATQN",
    "GGQN",
    "RQTF",
    "AQTF",
    "ASEG"}
    , [Confirmed Qty],

    blank()

    )

2 Replies

  • bansikpopat ,

    New columns

    Total Qty = Switch( True() ,

    [ Storage location] in {"0010","0020","MDD","MDR"} , [Confirmed Qty],

    blank()

    )

     

     

    QN = Switch( True() ,

    [ Storage location] in {"ATQN",
    "GGQN",
    "RQTF",
    "AQTF",
    "ASEG"}
    , [Confirmed Qty],

    blank()

    )

  • bansikpopat's avatar
    bansikpopat
    Frequent Visitor

    Thanks it worked. But I had to make a small change as I wanted to see the value of QN columns after filteration. 

    QN Column =
    SWITCH(
    True(),
    [Storage Location] in {"0010","0020","MDD","MDR"},
    [QN], blank()
    )