Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request 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]))
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 19 | |
| 14 | |
| 12 | |
| 10 | |
| 8 |