Microsoft Fabric Community Conference 2025, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount.
Register nowThe Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.
Hi everyone,
I have included a SWITCH function in a slider to alternate a visualization between a measure "A", a measure "B" and the sum of both if nothing is selected in the slider. The functions is as follows:
From the description of your problem, it seems the issue arises from the multi-value nature of the `VALUES` function when there's no selection in the slicer. This is especially true for visuals that expect single values.
1. When a single item is selected from the slicer:
- `ISCROSSFILTERED` returns TRUE and we enter the `SWITCH` function.
- `VALUES` will return a table with a single value, hence the comparisons you're making with `VALUES(Balances[Concepto])` are valid.
2. When no item is selected in the slicer:
- `ISCROSSFILTERED` returns FALSE.
- The formula goes to the else-part, which is `[BF_CA]+[BF_TD]`, and there shouldn’t be a problem here as it’s just a sum of two measures.
3. When multiple items are selected:
- This is probably where the problem arises. `VALUES` returns a table of multiple values, which isn’t valid for direct comparisons like `VALUES(Balances[Concepto]) = "Curr. Acc."`. If the visual is expecting a single value, it'll throw an error.
BF_Slicer =
VAR SelectedValueCount = COUNTROWS(VALUES(Balances[Concepto]))
RETURN
IF(
SelectedValueCount = 0, [BF_CA] + [BF_TD],
IF(
SelectedValueCount = 1,
SWITCH(TRUE(),
VALUES(Balances[Concepto]) = "Curr. Acc.", [BF_CA],
VALUES(Balances[Concepto]) = "Term dep.", [BF_TD],
BLANK()
),
BLANK() -- This line handles multiple selections, you can modify this to return a specific value or just blank
)
)
User | Count |
---|---|
121 | |
69 | |
66 | |
56 | |
52 |
User | Count |
---|---|
181 | |
85 | |
67 | |
61 | |
53 |