Forum Discussion

wilfredoperez's avatar
wilfredoperez
Regular Visitor
8 years ago
Solved

Filter Column using SelectedValue

Hello, I am new to powerbi and DAX and i have not been able to find a solution to this problem I have.

 

I have this table:

ID   |  ParentID  |   Time

A    |                  |     4

B    |                  |     2

C    |    A           |     2 

D   |    A            |     2

E    |    B            |     2

And I present this in a bar chart Time by ID. What I want to do is, on a table visualization, show the children of the selected bar should it have any. I can get the selected ID through a measurement SelectedID = SelectedValue('talbe'[ID]) and i have tried to filter the table visualization using the measurement result, create a calculated column by filtering the ID column and create a new table by filtering ID but nothing so far has worked. I know that tables and calculated columns are not dynamic which is why using those did not work.

 

Ultimately I think my problem is how to prepare a visual level filter so that the table only shows the rows where ParentID = SelectedID and both are string values.

 

Example Result: Select the bar for A 

ID   |   ParentID   |Time

C    |     A            |   2

D    |     A            |   2

 

Is this possible? if so, how would one do it? 

 

  • alexei7's avatar
    alexei7
    8 years ago

    Hi,

     

    So one way of doing it would be the following:

     

    1) go into "edit query" and duplicate your main "talbe" table

    2) create the join between talbe[id] and talbe2[ParentID].

    3) create the bar chart using talbe and the table using talbe2

     

    Clicking on the bar chart should filter and do what you want.

     

    Hope that helps

    Alex

5 Replies

  • alexei7's avatar
    alexei7
    Continued Contributor

    Hi wilfredoperez,

     

     

    Do you mean that when ID "A" is selected, that you want to see all ParentIDs = "A", as in the bottom table in your post?

     

    Alex

      • alexei7's avatar
        alexei7
        Continued Contributor

        Hi,

         

        So one way of doing it would be the following:

         

        1) go into "edit query" and duplicate your main "talbe" table

        2) create the join between talbe[id] and talbe2[ParentID].

        3) create the bar chart using talbe and the table using talbe2

         

        Clicking on the bar chart should filter and do what you want.

         

        Hope that helps

        Alex