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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
mmoggia
Frequent Visitor

How to union the results of 2 slicers on the same column

Hi, I have 2 slicers on the same column (e.g., KPI). I also have 2 line charts, and in each line chart I display the timeseries of 1 KPI (used edit interactions to have each slicer's selection affect only one line chart).

In the same page I also have a table, in which I would like to display information about both KPIs selected separately with the 2 slicers (basically I want to union the results of the selection).

Does anyone know if and how this is possible to achive in Power BI (e.g., creating an ad-hoc measure to filter the table)?

 

3 REPLIES 3
mmoggia
Frequent Visitor

Hi @Greg_Deckler , thanks for the reply. Here some more details with sample data:

Raw data

KPIQUARTERVALUE
AQ1-2310
AQ2-2312
BQ1-23100
BQ2-23120

 

Power BI Visual Elements

2 slicers and 2 line charts:

mmoggia_0-1694615050694.png

One table filtered with the union of the results from the 2 slicers (KPIs A & B):

mmoggia_1-1694615076437.png

NB: I have lot of KPIs and having the 2 slicers not filtering the table is not the solution cause in the table all KPIs will be visible (not just A&B, as wanted here).

 

Hope this clarifies better.

@mmoggia OK, so here is a thought. Create 2 tables for your slicers using DISTINCT('Table'[KPI]). Make sure these are disconnected tables ( no relationships ). You can then construct a complex selector similar to the following:

Complex Selector =
  VAR __KPI = MAX('Table'[KPI])
  VAR __Slicer1 = DISTINCT('Slicer1'[KPI])
  VAR __Slicer2 = DISTINCT('Slicer2'[KPI])
  VAR __SlicerTable = UNION( __Slicer1, __Slicer2 )
  VAR __Return = IF( __KPI IN __SlicerTable, 1, 0 )
RETURN
  __Return

Then use your Filter pane to filter the table for when this measure equals 1.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Greg_Deckler
Super User
Super User

@mmoggia It sounds like you want a Complex Selector, but it's difficult to know for sure without more information. The Complex Selector - Microsoft Fabric Community

 

Sorry, having trouble following, can you post sample data as text and expected output?
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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