Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

filter a column with same value as selected value in slicer

Hello Power BI Community !

 

I am trying to do something that is supposed to be very simple but I can't manage to do it.

 

I have a slicer that call a column ('Facts'[Company]) with 5 values (AAPL, MSFT, FB, AMZN, GOOG)

When one of theses values is selected, I want another column ('Facts'[Company Flag], which has same values, to be filtered according to the filtered value.

 

I think It should be a Dax formula with SelectedValue and Switch/IF, but I am not sure how to do it. can you help me please ?

Maybe like :

MyCustomFilter = IF SelectedValue('Facts'[Company]) = "AAPL";

Filter('Facts'[Company Flag],"AAPL"

 

right ?

 

Best regards,

MYPE

7 Replies

  • AlB's avatar
    AlB
    Icon for Community Champion rankCommunity Champion

    Hi Anonymous

    I'm not sure I understand correctly but if 'Facts'[Company] and 'Facts'[Company Flag] are on the same table and have the same values, if you filter 'Facts'[Company] through a slicer you will be effectively filtering 'Facts'[Company Flag] as well, won't you?

      • v-juanli-msft's avatar
        v-juanli-msft
        Icon for Community Support rankCommunity Support

        Hi Anonymous

        It is very strange :

        when i add "company" column(in table1 or table2) to the slicer, it only show "APPL" avlue, other values don't exsit.

        Could you clear me?

         

        Best Regards

        Maggie

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    Can you share a sample of your data? If those two columns are in the same table and have the same values then when you filter one, it should essentially filter the other. But, one thing that you could do potentially would be something like this:

     

    Measure = 
    VAR __filter = MAX('Facts'[Company])
    VAR __table = Filter('Facts', [Company Flag]=__filter)
    RETURN
    //do something here with your __table var

    Not really certain what you are trying to accomplish.

    • Anonymous's avatar
      Anonymous
      Not applicable
      Greg_Deckler, Please find here the pbi file : https://1drv.ms/u/s!AkOv33tEaCSwoztpRFuXSotYJhDj What I am trying to do is : In "Key events" tab, there is a pulse chart .On this chart, I want o display only the pop ups that correspond to the company filtered on the "company slicer". For example, If the company "AAP"L is selected on the slicer, I want only the popup of AAPL to be displayed on the chart (they already have been flagged "AAPL" in the "Company Flag Column"). Is it clear now ? Best regards MYPE
    • Anonymous's avatar
      Anonymous
      Not applicable
      Greg_Deckler, Please find access to the file right here : https://1drv.ms/u/s!AkOv33tEaCSwoztpRFuXSotYJhDj What I want to do : In the report, there is a tab called "Key Events". In this tab, there is a pulse chart with pop ups that display information from companies. Right now, all pop ups are displayed but I would like to display only pop up related to companies filtered on the slicer. Ex : I filter the company "AAPL" on the slicer, then I want only the pop ups related to "AAPL" to be displayed on the chart. To do this, I created a column called 'Company Flag' that flags the right company to be displayed, but I don't know how to do it. Possible to help me ? Many thanks in advance ! Best regards MYPE