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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Anonymous
Not applicable

How to create slicer for multiple fact tables showing only active values in selected period

Hi community,

 

I need your help with creating slicer containing active values only.

 

I have three fact tables (plan1, plan2 and production) each connected to two dim tables (calendar and items).

 

Plan1

ItemNrDateQuantity
A10.7.202210
B10.8.20225
C12.8.20223
B5.9.20226

 

Plan2

ItemNrDateQuantity
A1.7.20225
A5.7.20225
B31.7.20225
C5.8.20223
B5.9.20226

 

Production

ItemNrDateQuantity
A30.6.20223
A2.7.20224
B1.8.20221
C1.8.20222
B7.9.20225

 

Items

ItemNrUoM
AKG
BPC
CM

 

I also have two slicers, date period from calendar and unit of measure (UoM) from items. What I want here is to filter slicer UoM to show only units active in selected period. Active means all UoM according to items tracked in at least one of the three fact tables in selected period.

 

In the example above for selected period

1.8.2022-31.8.2022 the slicer should offer PC and M,

1.6.2022-30.6.2022 the slicer should offer KG only.

 

I would appreciate any help. Thank you.

1 ACCEPTED SOLUTION

Try the below

Show slicer value = 
VAR SelectedItems =
    DISTINCT (
        UNION (
            VALUES ( Plan1[ItemNr] ),
            VALUES ( Plan2[ItemNr] ),
            VALUES ( Production[ItemNr] )
        )
    )
VAR CurrentItems =
    VALUES ( Items[ItemNr] )
RETURN
    IF ( NOT( ISEMPTY( INTERSECT( CurrentItems, SelectedItems))), 1 )

View solution in original post

4 REPLIES 4
johnt75
Super User
Super User

You could create a measure like

Show slicer value =
VAR SelectedItems =
    DISTINCT (
        UNION (
            VALUES ( Plan1[Item] ),
            VALUES ( Plan2[Item] ),
            VALUES ( Production[Item] )
        )
    )
VAR CurrentItem =
    SELECTEDVALUE ( Items[Item] )
RETURN
    IF ( CurrentItem IN SelectedItems, 1 )

and add that as a filter to the slicer visual, to only show when the value is 1

Anonymous
Not applicable

Unfortunately when I tried to use this solution in my original BI it didn't work. So I tried to find the reason for that. There is a scenario which causes the measure giving wrong result. If you add 1 row to Items table the measure won't work as expected anymore. @johnt75 , please take a look at that as I don't have enough knowledge to fix this.

Items

ItemNrUom
AKG
BPC
CM
DKG

Try the below

Show slicer value = 
VAR SelectedItems =
    DISTINCT (
        UNION (
            VALUES ( Plan1[ItemNr] ),
            VALUES ( Plan2[ItemNr] ),
            VALUES ( Production[ItemNr] )
        )
    )
VAR CurrentItems =
    VALUES ( Items[ItemNr] )
RETURN
    IF ( NOT( ISEMPTY( INTERSECT( CurrentItems, SelectedItems))), 1 )
Anonymous
Not applicable

@johnt75 , thank you very much. This is now the solution that works.

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

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

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.

Top Solution Authors
Top Kudoed Authors