Forum Discussion

erceve's avatar
erceve
Helper I
6 years ago
Solved

Formula style differences between different machines

Hello, I have a problem where formula's work on one machine but not on the other. I've made a template file which my company can use as a base fro reporting, this file contains a calendar created with a formula:

 

Kalender = 
  GENERATE ( 
    CALENDAR ( DATE ( 2020; 1; 1 ); today()  ); 
    VAR currentDay = [Date]
    VAR weekday = WEEKDAY( currentDay; 2 )
    VAR week = WEEKNUM( currentDay )    
    VAR day = DAY( currentDay )
    VAR month =  MONTH ( currentDay ) 
    VAR year =  YEAR ( currentDay )
  RETURN   ROW ( 
    "dag"; day; 
    "weekdagnummer"; weekday;
	"weekdag"; switch(weekday;
					1; "maandag";
					2; "dinsdag";
					3; "woensdag";
					4; "donderdag";
					5; "vrijdag";
					6; "zaterdag";
					7; "zondag");
    "week"; week;
    "maandnummer"; month;
	"maand"; switch(month;
					1; "januari";
					2; "februari";
					3; "maart";
					4; "april";
					5; "mei";
					6; "juni";
					7; "juli";
					8; "augusutus";
					9; "september";
				   10; "oktober";
				   11; "november";
				   12; "december");
    "jaar"; year )
  )

 

 

On the machine where I've created this it works perfectly, when I save the pbix and open it on my laptop (different machine)

 

the semicolons are replaced with comma's and the date formula doesn't work anymore, it's replaced with DATE ( 2020, 1, 1 ), the ones get underlined in red and the errror says: unexpected expression '1,'.

 

Same goes for the switch cases inside the formula's where the switch recognizes the values but not the results, i've tried putting the results in either double or single quotes but to no avail. Can somebody please explain me what's going on and how to make this formula work on any machine?

  • Hi erceve ,

     

    This really looks a strange issue. Can you check your separator settings on your machine under Regional settings?

     

    If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

     

    Thanks,

    Pragati

15 Replies

  • Hi erceve ,

     

    The first thing is that you haven't highlighted anything in RED in your DAX. Then going through your explanation, it looks like both the machines have a separator differently set-up, i.e Machine 1 has ';' (semicolon) and Machine 2 has ',' (comma).

     

    Therefore your formula modofied itself from semicolon to comma. That looks perfect.

    Try checking DAX on your MAchine 2 that every semicolon is correctly replaced by comma.

     

    Also, it will be good to see the screesnhot of the DAXon Machine 2 here.

     

    If this helps and resolves the issue, appreciate a Kudos and mark it as a Solution! 🙂

     

    Thanks,

    Pragati

    • erceve's avatar
      erceve
      Helper I

      wow that is a quick reply, here is a screenshot from machine 2, as you can see everything appears to have been replaced correctly

       

      • Pragati11's avatar
        Pragati11
        Super User

        Hi erceve ,

         

        Your DAX actually looks perfect to me. Can you share your .pbix file?

         

        Thanks,

        Pragati

  • Pragati11 

     

    appears I was too optimistic, the formula doesn't give any errors but also does not calculate anymore so it appears I'm still stuck