Forum Discussion
Expressions that yield variant data-type cannot be used to define calculated columns error
Hi,
I am using if(and statement but receiving "Expressions that yield variant data-type cannot be used to define calculated columns." error. Below is the code i am using Not sure whats causing the error. Can any one help me on this?
if(and(DAY(CY[Calendar Year]) =day(calculate(max(CY[Calendar Year]),all())),
MONTH(CY[Calendar Year]) = month(calculate(max(CY[Calendar Year]),all())),
YEAR(CY[Calendar Year]) = YEAR(calculate(max(CY[Calendar Year]),all())),"Last MonthLY"))))
Anonymous , I have not validated your calculation. Try like
if(and(DAY(CY[Calendar Year]) =day(calculate(max(CY[Calendar Year]),all())),
MONTH(CY[Calendar Year]) = month(calculate(max(CY[Calendar Year]),all())),
YEAR(CY[Calendar Year]) = YEAR(calculate(max(CY[Calendar Year]),all()))),"Last MonthLY")Anonymous , Try this
if(DAY(CY[Calendar Year]) =day(calculate(max(CY[Calendar Year]),all())) &&
MONTH(CY[Calendar Year]) = month(calculate(max(CY[Calendar Year]),all())) &&
YEAR(CY[Calendar Year]) = YEAR(calculate(max(CY[Calendar Year]),all())),"Last MonthLY")
3 Replies
- amitchandak
Super User
Anonymous , I have not validated your calculation. Try like
if(and(DAY(CY[Calendar Year]) =day(calculate(max(CY[Calendar Year]),all())),
MONTH(CY[Calendar Year]) = month(calculate(max(CY[Calendar Year]),all())),
YEAR(CY[Calendar Year]) = YEAR(calculate(max(CY[Calendar Year]),all()))),"Last MonthLY")- AnonymousNot applicable
amitchandak Thanks for your response. It returned following error message. I also shared the screenshot
"Too many arguments were passed to the AND function. The maximum argument count for the function is 2.
- amitchandak
Super User
Anonymous , Try this
if(DAY(CY[Calendar Year]) =day(calculate(max(CY[Calendar Year]),all())) &&
MONTH(CY[Calendar Year]) = month(calculate(max(CY[Calendar Year]),all())) &&
YEAR(CY[Calendar Year]) = YEAR(calculate(max(CY[Calendar Year]),all())),"Last MonthLY")