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
Anonymous
Not applicable

Fixed & Dynamic Values with Slicer

Hi,

 

So I am currently struggling with a problem where I am trying use a slicer to filter a column of values, whilst also always keeping a value (not included in the slicer).

 

A simplified example of the data is:

CategoryYearValue
A201811
A201913
A202019
B201810
B201912
B202017
Fixed201815
Fixed201914
Fixed202020

 

I want to be able to use a slicer to be left with:

CategoryYearValueNew Col
A20181111
A20191313
A20201919
Fixed20181515
Fixed20191414
Fixed20202020

 

When I filter to A, and 

CategoryYearValueNew Col
B20181010
B20191212
B20201717
Fixed20181515
Fixed20191414
Fixed20202020

 

when I filter to B. Any help or ideas would be much appreciated. To give a bit more context this is to create a waterfall to compare two categories (one being always fixed the other being dynamically selected).

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

I managed to solve my problem but I feel like it is a non-optimal solution.

 

I did this by creating a calculated table and 3 measures:

 

slic = DISTINCT('Table'[Category]) // This is linked to the main table
 
Fixed Measure = CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Category] == "Fixed"))
Swap Measure = SUM('Table'[Value])
Resulting Measure = CALCULATE([Fixed Measure], ALL(slic[Category])) + [Swap Measure]
 
The resulting measure column is what I was looking for, when you are slicing by the new "slic" table. If anyone has any recomendations that can implement the same functionality in an improved way please let me know.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

I managed to solve my problem but I feel like it is a non-optimal solution.

 

I did this by creating a calculated table and 3 measures:

 

slic = DISTINCT('Table'[Category]) // This is linked to the main table
 
Fixed Measure = CALCULATE(SUM('Table'[Value]), FILTER('Table', 'Table'[Category] == "Fixed"))
Swap Measure = SUM('Table'[Value])
Resulting Measure = CALCULATE([Fixed Measure], ALL(slic[Category])) + [Swap Measure]
 
The resulting measure column is what I was looking for, when you are slicing by the new "slic" table. If anyone has any recomendations that can implement the same functionality in an improved way please let me know.
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

We can create a measure as below and put it to the visual.

Measure =
VAR a =
    SELECTEDVALUE ( slic[Category] )
RETURN
    IF (
        ISFILTERED ( slic[Category] )
            && a = MAX ( 'Table'[Category] ),
        BLANK (),
        1
    )

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

Hi @v-frfei-msft , sorry but this solution filters to the two categories not selected, is there a way of doing so that we can always have Fixed shown and switch between the other two? Thanks

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.