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

Show value in chart at all times but don't show value in slicer

Hello,

 

I've got some dummy data to plot in a line chart alongside actual data. Is there any way to select an attribute at all times but not have it show in the slicer?

 

Here's what I mean, I want to plot 2015dummy and 2016dummy at all times but I only want to be able to select 2015/2016 from a slicer.

 

Slicer Column
2015
2015dummy
2016
2016dummy

 

1 ACCEPTED SOLUTION
mahoneypat
Employee
Employee

Here is an example.  I made a table like your slicer table for the slicer, and another table that has a column with same values (slicerkey) and a column with values for aggregation.  I used the slicerkey column in the visual along with the measure below to get the result shown.  I also added a Filter on the slicer visual in the Filter panel with Does Not Contain "Dummy".  The result is only the other options are shown in the slicer and the Dummy options are always in the visual for comparison.

 

mahoneypat_0-1608337579090.png

 

Dummy and Slicer =
VAR vDummyTable =
    FILTER (
        ALL ( Slicer[Slicer] ),
        SEARCH (
            "Dummy",
            Slicer[Slicer],
            ,
            0
        ) > 0
    )
VAR vSelected =
    ALLSELECTED ( Slicer[Slicer] )
VAR vCombined =
    DISTINCT (
        UNION (
            vDummyTable,
            vSelected
        )
    )
RETURN
    CALCULATE (
        SUM ( Slicer[Value] ),
        vCombined
    )

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

6 REPLIES 6
Anonymous
Not applicable

thanks @mahoneypat , that looks good!

mahoneypat
Employee
Employee

Here is an example.  I made a table like your slicer table for the slicer, and another table that has a column with same values (slicerkey) and a column with values for aggregation.  I used the slicerkey column in the visual along with the measure below to get the result shown.  I also added a Filter on the slicer visual in the Filter panel with Does Not Contain "Dummy".  The result is only the other options are shown in the slicer and the Dummy options are always in the visual for comparison.

 

mahoneypat_0-1608337579090.png

 

Dummy and Slicer =
VAR vDummyTable =
    FILTER (
        ALL ( Slicer[Slicer] ),
        SEARCH (
            "Dummy",
            Slicer[Slicer],
            ,
            0
        ) > 0
    )
VAR vSelected =
    ALLSELECTED ( Slicer[Slicer] )
VAR vCombined =
    DISTINCT (
        UNION (
            vDummyTable,
            vSelected
        )
    )
RETURN
    CALCULATE (
        SUM ( Slicer[Value] ),
        vCombined
    )

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


v-yangliu-msft
Community Support
Community Support

Hi  @Anonymous  ,

According to your description, I created the data:

v-yangliu-msft_0-1608253787038.png

v-yangliu-msft_1-1608253787040.png

Here are the steps you can follow:

1. Create measure.

Measure 2 =
var _selected=SELECTEDVALUE('Table'[Slicer])
return
SWITCH(_selected,
2015,
IF(MAX('Table (2)'[Slicer Column])="2016",BLANK(),MAX('Table (2)'[Slicer Column])),
2016,
IF(MAX('Table (2)'[Slicer Column])="2015",BLANK(),MAX('Table (2)'[Slicer Column])),MAX('Table (2)'[Slicer Column]))

2. Result

v-yangliu-msft_2-1608253787043.jpeg

You can downloaded PBIX file from here.

 

If my answer is not what you need, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

@v-yangliu-msft  thanks, this is very close to what i need. However it's not dynamic enough as the years are explicitly written. Is there a version of this that doesn't need explicit declaration?

mahoneypat
Employee
Employee

You can make a measure that first makes a UNION of the VALUES selected in your slicer with a constant table that includes the ones you want there permanently, and then use that unioned table in CALCULATE for your base measure.

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Anonymous
Not applicable

@mahoneypat thanks for the response - I'm confused on a few things.

 

1. How do I make a measure using union? it seems like I can only make a table which doesn't seem to be dynamic enough for this solution. If I make it as a table it looks like: 

distinct(union(<table with dummy values>, VALUES(<column in the slicer>)))
but this doesn't work in a measure
 
2. How do i refer to the above table in a CALCULATE statement while still referring to the slicer selection?
 
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.