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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
jaiye
New Member

Key value pair in slicer

Hello Power BI Community,
I'm working on a Power BI report and need some assistance with setting up a hierarchical slicer and ensuring dynamic filtering in my matrix visualization. Here’s the scenario I’m dealing with:

Data Structure:
• I have a table with Key and Value columns.
• Key can be things like "Assisting Adjuster," and Value can be various text or numeric data associated with these keys.
Requirements:
1 Hierarchical Slicer: I need a slicer that allows users to select both keys and values. When a key is expanded, it should show the related values.
2 Dynamic Filtering: When users select a value in the slicer, the matrix should display filtered data corresponding to that value while keeping other columns visible.

Steps Taken So Far:
• I created a combined table in Power Query to differentiate between keys and values.
• I added a slicer using this combined table.
• I attempted to create DAX measures to handle the filtering but encountered errors when dealing with multiple selections.
Challenges:
• The measure I created throws an error about multiple columns not being convertible to a scalar value.
• I need guidance on correctly implementing dynamic filtering so that when a value is selected, the matrix only shows the relevant data but retains all columns.
What I Need Help With:
1 Creating a hierarchical slicer that supports selecting multiple keys and values.
2 Developing a measure or a method to filter the matrix visualization dynamically based on the slicer selection while keeping other columns visible.
Any guidance, examples, or resources would be greatly appreciated!
Thank you!

 

@amitchandak

2 REPLIES 2
Sahir_Maharaj
Super User
Super User

Hello @jaiye,

 

To perform dynamic filtering, you can use DAX:

SelectedValueMeasure = 
VAR SelectedKey = SELECTEDVALUE(YourTable[Key])
VAR SelectedValue = SELECTEDVALUE(YourTable[Value])
RETURN
    IF(
        ISBLANK(SelectedKey),
        1,
        IF(
            ISBLANK(SelectedValue),
            IF(MAX(YourData[Key]) = SelectedKey, 1, 0),
            IF(MAX(YourData[Key]) = SelectedKey && MAX(YourData[Value]) = SelectedValue, 1, 0)
        )
    )

 

Hope this helps - Alternatively, lets connect and I can guide you through the process - Yes, its FREE 🙂

 (https://topmate.io/sahirmaharaj/649292)


Did I answer your question? Mark my post as a solution, this will help others!

If my response(s) assisted you in any way, don't forget to drop me a "Kudos" 🙂

Kind Regards,
Sahir Maharaj
Data Scientist | Data Engineer | Data Analyst | AI Engineer
P.S. Want me to build your Power BI solution? (Yes, its FREE!)
➤ Lets connect on LinkedIn: Join my network of 15K+ professionals
➤ Join my free newsletter: Data Driven: From 0 to 100
➤ Website: https://sahirmaharaj.com
➤ Email: sahir@sahirmaharaj.com
➤ Want me to build your Power BI solution? Lets chat about how I can assist!
➤ Join my Medium community of 30K readers! Sharing my knowledge about data science and artificial intelligence
➤ Explore my latest project (350K+ views): Wordlit.net
➤ 100+ FREE Power BI Themes: Download Now
LinkedIn Top Voice in Artificial Intelligence, Data Science and Machine Learning

Hi @Sahir_Maharaj 

Unfortunately, this is not working. When i select the keys it is returning 1 for every keys that is not selected in my slicer

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

Check out the August 2025 Power BI update to learn about new features.

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors