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.
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 |
Solved! Go to Solution.
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.
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
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.
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Hi @Anonymous ,
According to your description, I created the data:
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
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.
@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?
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
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
@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:
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
106 | |
93 | |
75 | |
62 | |
50 |
User | Count |
---|---|
147 | |
107 | |
105 | |
87 | |
61 |