Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!
I'm getting a error in this formula, the true/false expression must point to one column?
What goes wrong?
Ist Year:=VAR Current_Item= IF(HASONEVALUE('Template Ertragslage'[Ertragslage]);VALUES('Template Ertragslage'[Ertragslage]))
RETURN
SWITCH(
TRUE();
Current_Item = "Gesamtleistung"; CALCULATE([Gesamtleistung];DATESYTD(Datumtabel[Date]));
Current_Item= "Rohergebnis"; CALCULATE([Rohergebnis];DATESYTD(Datumtabel[Date]));
Current_Item = "Betrieblicher Aufwand"; CALCULATE([Betrieblicher Aufwand];DATESYTD(Datumtabel[Date]));
Current_Item= "EBITDA"; CALCULATE([EBITDA];DATESYTD(Datumtabel[Date]));
Current_Item = "EBIT"; CALCULATE([EBIT];DATESYTD(Datumtabel[Date]));
Current_Item= "EBT (I)"; CALCULATE([EBT (I)];DATESYTD(Datumtabel[Date]));
Current_Item = "EBT (II)"; CALCULATE([EBT (II)];DATESYTD(Datumtabel[Date]);
Current_Item= "Jahresüberschuss"; CALCULATE([Jahresüberschuss];DATESYTD(Datumtabel[Date]));
Current_Item = "AfA"; CALCULATE([AfA];DATESYTD(Datumtabel[Date]));
Current_Item= "Brutto Cash Flow"; CALCULATE([Brutto Cash Flow];DATESYTD(Datumtabel[Date]));
CALCULATE(
[Ist bedrag];
FILTER('Ertragslage Ist';
'Ertragslage Ist'[Ertragslage] = Current_Item));
DATESYTD(Datumtabel[Date])))
Hi @marsclone ,
I think it's because your Current_Item variable uses the VALUES() function as its output. Per the MS docs:
https://learn.microsoft.com/en-us/dax/values-function-dax
I.e, your variable is not outputting a scalar value that can be evaluated as a condition in your SWITCH() function.
I would try updating your variable as follows:
VAR Current_Item = SELECTEDVALUE('Template Ertragslage'[Ertragslage])
Pete
Proud to be a Datanaut!
Hi @BA_Pete
Thank you for your answer. The problem that i have, is that i work with power query and power pivot. Selectedvalue doesn't work here.
I have the solution by calculating the values independently.
Now i have the measure to calculate the value YTD, but now i become the error:
Function 'SWITCH' does not support comparing values of type True/False with values of type Number. Consider using the VALUE or FORMAT function to convert one of the values.
Can you see which value i have to format or value so that this measure will work?
Thank you in advance!
Ist Year:=
VAR Current_Item= IF(HASONEVALUE('Template Ertragslage'[Ertragslage]);VALUES('Template Ertragslage'[Ertragslage]))
RETURN
SWITCH(
TRUE();
Current_Item = "Gesamtleistung"; [Gesamtleistung Year];
Current_Item= "Rohergebnis"; [Rohergebnis Year];
Current_Item = "Betrieblicher Aufwand"; [Betrieblicher Aufwand Year];
Current_Item= "EBITDA"; [EBITDA Year];
Current_Item = "EBIT"; [EBIT Year];
Current_Item= "EBT (I)"; [EBT (I) Year];
Current_Item = "EBT (II)"; [EBT (II) Year];
Current_Item= "Jahresüberschuss"; [Jahresüberschuss Year];
Current_Item = "AfA"; [AfA Year];
Current_Item= "Brutto Cash Flow"; [Brutto Cash Flow Year];
CALCULATE(
[Ist bedrag Year];
FILTER('Ertragslage Ist';
'Ertragslage Ist'[Ertragslage] = Current_Item));DATESYTD(Datumtabel[Date]))
Vote for your favorite vizzies from the Power BI World Championship submissions!
If you love stickers, then you will definitely want to check out our Community Sticker Challenge!
Check out the January 2026 Power BI update to learn about new features.
| User | Count |
|---|---|
| 11 | |
| 10 | |
| 6 | |
| 6 | |
| 5 |