SOLVED

DAX IF error: the syntax is incorrect

Iron Contributor

The answer to this must be really simple but I can't find it...

I have the following formula in Power Pivot,

=IF([Minstock]>0, 1, 0)

where MinStock is a column in the same table of data type "Whole number",

but I get the error "The syntax for '1.' is incorrect", and I can't figure out why?

bartvana_1-1629020939017.png

Could this have something to do with regional settings? In Excel formulas, I use semicolon instead of comma, and in my PowerPivot, the decimal numbers have a comma instead of a point.

bartvana_2-1629021622548.png

 

9 Replies

@bartvana See if this simple model works on your end. I'm using the comma as the list separator, but have read that local settings may influence DAX formulas. Not my expertise, however.

 

@Riny_van_Eekelen It gives the same error when I select the formula and press Enter in Power Pivot:

bartvana_0-1629023404580.png

 

@bartvana Did you try with semi-colons?

Yes, same error:

bartvana_0-1629025180116.png

 

@bartvana what if you change the local setting of your system to English (UK) and restart the lot? Otherwise I can't think of anything else.

That's a bit drastic and would have other unwanted effects, I think? It can't be that the only way to use DAX is to have your while system set to English UK, right?

@bartvana Google for "regional settings power pivot" or "regional settings DAX" and you'll see that regional settings can have an impact. Not for me, though, as I use English Excel with UK settings.

Yes, it seems, though I don't find a solution to my problem anywhere. I don't want English separators and date formats everywhere in Excel, but I do want to use DAX formulas...
best response confirmed by bartvana (Iron Contributor)
Solution

I seemed to have solved it by changing the list separator in Windows Regional settings to semicolon, and then using the semicolon in the DAX formula.

=IF([MinStock] > 0; 1; 0)

For future reference, I found the settings here:

Windows key, then type "region":

bartvana_0-1629029579053.png

 

In the "Regional Format" window, click on "Additional date, time & regional settings"

bartvana_1-1629029630068.png

Then "Change date, time or number formats"

bartvana_2-1629029717624.png

 

There: "Additional settings"

bartvana_3-1629029768509.png

There, change "List separator" to semicolon:

bartvana_4-1629029826614.png

I then restarted Excel, not sure if that was necessary.

 

(To be complete, I also first changed the decimal and grouping separators to respectively point (.) and comma (,) but finally reverted them and it still works.)

 

1 best response

Accepted Solutions
best response confirmed by bartvana (Iron Contributor)
Solution

I seemed to have solved it by changing the list separator in Windows Regional settings to semicolon, and then using the semicolon in the DAX formula.

=IF([MinStock] > 0; 1; 0)

For future reference, I found the settings here:

Windows key, then type "region":

bartvana_0-1629029579053.png

 

In the "Regional Format" window, click on "Additional date, time & regional settings"

bartvana_1-1629029630068.png

Then "Change date, time or number formats"

bartvana_2-1629029717624.png

 

There: "Additional settings"

bartvana_3-1629029768509.png

There, change "List separator" to semicolon:

bartvana_4-1629029826614.png

I then restarted Excel, not sure if that was necessary.

 

(To be complete, I also first changed the decimal and grouping separators to respectively point (.) and comma (,) but finally reverted them and it still works.)

 

View solution in original post