SOLVED

DAX IF error: the syntax is incorrect

%3CLINGO-SUB%20id%3D%22lingo-sub-2649553%22%20slang%3D%22en-US%22%3EDAX%20IF%20error%3A%20the%20syntax%20is%20incorrect%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2649553%22%20slang%3D%22en-US%22%3E%3CP%3EThe%20answer%20to%20this%20must%20be%20really%20simple%20but%20I%20can't%20find%20it...%3C%2FP%3E%3CP%3EI%20have%20the%20following%20formula%20in%20Power%20Pivot%2C%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-excel-formula%22%3E%3CCODE%3E%3DIF(%5BMinstock%5D%26gt%3B0%2C%201%2C%200)%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3Ewhere%20MinStock%20is%20a%20column%20in%20the%20same%20table%20of%20data%20type%20%22Whole%20number%22%2C%3C%2FP%3E%3CP%3Ebut%20I%20get%20the%20error%20%22The%20syntax%20for%20'1.'%20is%20incorrect%22%2C%20and%20I%20can't%20figure%20out%20why%3F%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22bartvana_1-1629020939017.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F303320iA7DE19327B5D399C%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22bartvana_1-1629020939017.png%22%20alt%3D%22bartvana_1-1629020939017.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3ECould%20this%20have%20something%20to%20do%20with%20regional%20settings%3F%20In%20Excel%20formulas%2C%20I%20use%20semicolon%20instead%20of%20comma%2C%20and%20in%20my%20PowerPivot%2C%20the%20decimal%20numbers%20have%20a%20comma%20instead%20of%20a%20point.%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22bartvana_2-1629021622548.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F303321i33BF49DE7F78214A%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22bartvana_2-1629021622548.png%22%20alt%3D%22bartvana_2-1629021622548.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2649553%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EBI%20%26amp%3B%20Data%20Analysis%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EPower%20BI%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2649577%22%20slang%3D%22en-US%22%3ERe%3A%20DAX%20IF%20error%3A%20the%20syntax%20is%20incorrect%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2649577%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F863782%22%20target%3D%22_blank%22%3E%40bartvana%3C%2FA%3E%26nbsp%3BSee%20if%20this%20simple%20medel%20works%20on%20your%20end.%20I'm%20using%20the%20comma%20as%20the%20list%20separator%2C%20but%20have%20read%20that%20local%20settings%20may%20influence%20DAX%20formulas.%20Not%20my%20expertise%2C%20however.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2649579%22%20slang%3D%22en-US%22%3ERe%3A%20DAX%20IF%20error%3A%20the%20syntax%20is%20incorrect%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2649579%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F403176%22%20target%3D%22_blank%22%3E%40Riny_van_Eekelen%3C%2FA%3E%26nbsp%3BIt%20gives%20the%20same%20error%20when%20I%20select%20the%20formula%20and%20press%20Enter%20in%20Power%20Pivot%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22bartvana_0-1629023404580.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F303323i7E2CBE927D19F322%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22bartvana_0-1629023404580.png%22%20alt%3D%22bartvana_0-1629023404580.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2649581%22%20slang%3D%22en-US%22%3ERe%3A%20DAX%20IF%20error%3A%20the%20syntax%20is%20incorrect%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2649581%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F863782%22%20target%3D%22_blank%22%3E%40bartvana%3C%2FA%3E%26nbsp%3BDid%20you%20try%20with%20semi-colons%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2649623%22%20slang%3D%22en-US%22%3ERe%3A%20DAX%20IF%20error%3A%20the%20syntax%20is%20incorrect%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2649623%22%20slang%3D%22en-US%22%3E%3CP%3EYes%2C%20same%20error%3A%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22bartvana_0-1629025180116.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F303328iF9212DFF46BC9005%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22bartvana_0-1629025180116.png%22%20alt%3D%22bartvana_0-1629025180116.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Frequent 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 (Frequent 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.)