The ultimate Microsoft Fabric, Power BI, Azure AI, and SQL learning event: Join us in Stockholm, September 24-27, 2024.
Save €200 with code MSCUST on top of early bird pricing!
Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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
)
)
Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.
Check out the August 2024 Power BI update to learn about new features.
User | Count |
---|---|
113 | |
83 | |
75 | |
51 | |
42 |
User | Count |
---|---|
140 | |
113 | |
73 | |
64 | |
62 |