Forum Discussion
dynamic chart to allow multiple selections from two (or more) slicers
- 4 years ago
Instead of SELECTEDVALUE you need to use VALUES, and because that returns a table you need to use IN instead of =, e.g.
bal num = VAR slicer1 = VALUES ( table1[status_now] ) VAR slicer2 = VALUES ( table1[status_prev] ) RETURN CALCULATE ( SUM ( table1[balance] ), table1[status_now] IN slicer1, table1[status_prev] IN slicer2 )
Instead of SELECTEDVALUE you need to use VALUES, and because that returns a table you need to use IN instead of =, e.g.
bal num =
VAR slicer1 =
VALUES ( table1[status_now] )
VAR slicer2 =
VALUES ( table1[status_prev] )
RETURN
CALCULATE (
SUM ( table1[balance] ),
table1[status_now] IN slicer1,
table1[status_prev] IN slicer2
)
Thanks Johnt75 - that worked!
Do you happen to know the difference between your solution and this?
It looks to give the same or similar answer but something feels off with the below version.
bal num =
var slicer1= SELECTEDVALUE(table1[status_now])
var slicer2= SELECTEDVALUE(table1[status_prev])
return
CALCULATE(sum(table1[balance])
,ALLSELECTED(table1[status_now])
,ALLSELECTED(table1[status_prev])
)
- johnt754 years ago
Super User
ALLSELECTED removes any filters which are applied by the current visual but retains filters which are applied externally. For example, if you had a table visual showing a split by category, which was also affected by a slicer on category, then inside the table visual ALLSELECTED would remove the filter on the current category for that row but would retain the filtered categories from the slicer.
VALUES will not remove any filters, it will always show those values which are available in the current filter context. So in the previous example, within a table visual split by category, on each row VALUES would only return the current category.
If no filters are applied within the visual then the results would be the same.
- leeham4 years agoFrequent Visitor
Thanks again.
There are other filter/slicers within the main visual (product and other things) which are meant to alter both the numerator and the denominator.
I think your solution allows for these other filters from what you've said which is perfect.