Forum Discussion
iplaygod
7 years agoResolver I
DAX: How update a variable value after having defined the variable?
I am writing DAX In most other coding languages, I can define a variable, give it a value, and then later on in the code change or add to that value. Eg: VAR myVariable = 1 //later in the code:...
v-yulgu-msft
7 years agoMicrosoft Employee
Hi iplaygod,
I don't think we can re-define a variable with the same name.
If you want to achieve below formula
VAR concatString = ""
//then later in the code
concatString = concatString & "|" & newValue
You may need to define two different variables like this:
VAR concatString = ""
VAR concatString2 = concatString & "|" & newValue
Best regards,
Yuliana Gu
- iplaygod7 years agoResolver I
ok thanks
so follow-up question...
is it possible to create a variable and naming it by using a string?
like in Power Query (M) language you can use
#"myVariable"
is there a similar alternate syntax for defining / naming variables in DAX?
- v-yulgu-msft7 years agoMicrosoft Employee
Hi iplaygod,
Hope this document about naming syntax of variable is helpful to you.
Best regards,
Yuliana Gu