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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
cosminzanfir
Frequent Visitor

Slice value based on disconnected table with dynamic values

Hello,

Is there a solution for the following problem?
I have a measure ( a simple SUM) that is going to be displayed in a Matrix visual.
I need to filter that value based on a selected version from a slicer.
The issue is that the values from the slicer will change in time. So working with SWITCH ( hardcoded values) is not a solution.

 

Is there a way to achieve a measure that is recalculated based on the user selection from a slicer?

 

Now i have the fact table - containing the data used for the SUM and a disconnected table used for slicing the data.

 

cosminzanfir_0-1662019362593.png

 

1 ACCEPTED SOLUTION
johnt75
Super User
Super User

It depends on what you are trying to achieve. If your disconnected table contains values which appear in a column in your fact table, and you want the slicer to choose only those values, you can do something like

Measure with filter = CALCULATE( [Base measure], TREATAS( VALUES('Disconnected table'[Column]), 'Fact table'[Column]) )

View solution in original post

6 REPLIES 6
cosminzanfir
Frequent Visitor

Thank you @johnt75 .
I was able to resolve the issue by using SELECTEDVALUE

 

VAR selection =
    SELECTEDVALUE ( Table[ Level 01.Key], [Plan] )
VAR selectioncalculated =
    IF (
        SELECTEDVALUE ( Table[ Level 01.Key]) = BLANK (),
        [Plan],
        CALCULATE (
            [Plan],
            FILTER ( Table, Table[ Level 01.Key] = selection )
        )
    )
RETURN
    selectioncalculated

That's good, but bear in mind it will not work if the user selects multiple options from the slicer, it will perform the same calculation as if they made no selections. TREATAS will work for 0, 1 or more selections

johnt75
Super User
Super User

It depends on what you are trying to achieve. If your disconnected table contains values which appear in a column in your fact table, and you want the slicer to choose only those values, you can do something like

Measure with filter = CALCULATE( [Base measure], TREATAS( VALUES('Disconnected table'[Column]), 'Fact table'[Column]) )

Using TREATAS might be a better solution but keep getting the error:

cosminzanfir_0-1662024176331.png

 

Not sure if this will work, but you could try duplicating the TREATAS, one version using 'Table'[Version.Version Level 01] and one version using 'Table'[Version.Version Level 01.Key]

Just tried it...not a solution. the message stays the same. But anyway. the solution is ok, just need to make sure to set it to single select.
Thank you @johnt75 

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.