Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Kohrinn
Helper I
Helper I

Filter by values in different rows

Hi,

I have a problem with filtering in such a scenario:

 

I have materials to be produced. Each material has its own MaterialID. Production of a material requires at least one recipe. Each recipe uses certain number of resources.

Each row in my table Production stores information about produced material, recipe and used resources. If there's 3 recipes to produce one material, there will be 3 rows in my table. Table Resources stores all available resources.

By clicking on first visual, I select produced material by its ID. The visual below shows recipes that belong to this MaterialID.

 

I've made a measure Filter Only Resources From Recipe that filters out resources for selected recipe in the third visual. What I want to achieve now is to show all the resources that are used to produce selected MaterialID, not only for one recipe. How to do it?
BTW: Is that any better way then what I've made in my measure to filter resources?

 

Here's my pbix : Link 

 

 

Thanks,

Joanna

4 REPLIES 4
gmsamborn
Super User
Super User

Hi @Kohrinn 

 

By unpivoting the Production table and creating a couple of dimension tables and indexes, I did it with no measures.

Resources - test.pbix



Proud to be a Super User!

daxformatter.com makes life EASIER!
smpa01
Super User
Super User

@Kohrinn  you can do something like this

Measure = CONCATENATEX(Production,Production[Recipes]&"-"&Production[UsedResource01]&","&Production[UsedResource02]&","&Production[UsedResource03]," || ",Production[Recipes],ASC)

 

smpa01_0-1701963700128.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Thank you, but it's not what I meant.

This is what's in my table:

Kohrinn_0-1701967949522.png

 

So I know that in order to produce 111 I need A,J,K,C,D,G,H,I. So when I click on my visual with MaterialID and Iwant to have resources filtered like that:

 

Kohrinn_1-1701968098480.png

 

@Kohrinn  you can use this a filter

smpa01_0-1701973075729.png

 

Measure = 
MAXX (
    NATURALINNERJOIN (
        SUMMARIZE (
            ADDCOLUMNS (
                FILTER (
                    UNION (
                        SELECTCOLUMNS ( 'Production', 'Production'[UsedResource01] ),
                        SELECTCOLUMNS ( 'Production', 'Production'[UsedResource02] ),
                        SELECTCOLUMNS ( 'Production', 'Production'[UsedResource03] )
                    ),
                    'Production'[UsedResource01] <> BLANK ()
                ),
                "col", [UsedResource01]
            ),
            [col]
        ),
        SUMMARIZE (
            SELECTCOLUMNS ( { MAX ( Resources[ResourceID] ) }, "col", [Value] ),
            [col]
        )
    ),
    [col]
)
Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.