Forum Discussion
C4L84
4 years agoAdvocate II
Addcolumn with if statement
Hi community, I'm looking for some help with an ADDCOLUMN expression. I need to add a new column called "RevenueType" in the BookingStatus table which groups BookingCodes A, R, H and CX as "C...
C4L84
4 years agoAdvocate II
SpartaBI I need to specifically use the ADDCOLUMN funtion, something like this:
RevenueType =
ADDCOLUMNS('Booking statuses',"RevenueType",
IF(MIN('Booking statuses'[BookingCode]) in {"A","R","H","CX"}, "Confirmed revenue", "Provisional")
)
But I am getting this error message:
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.
Vasuno1
3 years agoFrequent Visitor
C4L84 - Sorry I didn't realize that you reiterated your absolute need to use the ADDCOLUMNS function (nor did I notice that someone already posted the exact solution I did 😞)
C4L84 / Ivn_rmr - I used the below formula to create the table using the ADDCOLUMNS function:
RevenueType = ADDCOLUMNS('Booking statuses',"RevenueType",IF('Booking statuses'[BookingCode] in {"A","R","H","CX"},"Confirmed Revenue", "Provisional"))