Forum Discussion
Zepox
3 years agoFrequent Visitor
Can perform multiplication but cannot perform addition.
Hello,
With the following code I store the year in a variable. OrderDate is a string in dd/mm/yy format.
VAR _year = CALCULATE(RIGHT(MAX(DIM_PurchaseOrder[OrderDate]), 2), CROSSFILTER(FACT_MaterialRequirements[AK_Order], DIM_PurchaseOrder[AK_PurchaseOrder], Both))
Now let's say I get 22 and want to add 2000 (+2000) to make it 2022, the returned result is 2000, if I add 10 (+10) the returned result is 10 etc. I have tried using VALUE() to change the year to number but this does not seem to change anything.
But when I try to multiply with 10 (*10) I do get the expected result of 220. Any idea why this is?
Thank you in advance
1 Reply
- lbendlin
Super User
RIGHT(MAX(DIM_PurchaseOrder[OrderDate]), 2)That is a text string, consisting of two text characters. To do math with that you will want to convert to a number, or use the YEAR() function.