Forum Discussion
IF statement with LEN, LEFT & RIGHT formulas
- 8 years ago
i only changed the position of the parentheses
Column 2 = IF(LEN(Table1[Flight No Column]) =11, RIGHT(Table1[Flight No Column], 5), CONCATENATE(LEFT(Table1[Flight No Column], 2), RIGHT(Table1[Flight No Column], 3))
With the above code, I can not go to the second step of the if command as shown here:
I am still failing to write down the correct syntax.
Can i kindly ask you to upload your functional Power Bi file?
Can you please share the yellow error message in the screenshot. Also try to copy/paste this :
Column = if (LEN(Table1[Flight No Column]) = 11, right(Table1[Flight No Column],5), CONCATENATE(left(Table1[Flight No Column],2),RIGHT(Table1[Flight No Column],3)))
- airportplanner8 years agoFrequent Visitor
NipponSahoreunfortunately your code is not working
I can not replicate the working example from BKirsch12
I am uploading my file, would you mind taking a look ?
https://drive.google.com/open?id=1Tki-_fl_X6HqY2Ea9bV4fV-Je_nxEzQP
The error I am getting is this one:
- NipponSahore8 years agoResolver II
i only changed the position of the parentheses
Column 2 = IF(LEN(Table1[Flight No Column]) =11, RIGHT(Table1[Flight No Column], 5), CONCATENATE(LEFT(Table1[Flight No Column], 2), RIGHT(Table1[Flight No Column], 3))
- BKirsch128 years agoResolver II
Yes Nippon is right, the issue is your LEN function needs to return a value before it can be compared to 11.
- BKirsch128 years agoResolver II
The problem is the LEN function. This is what you had in the file you sent:
Column 2 = IF(LEN(Table1[Flight No Column] =11), RIGHT(Table1[Flight No Column], 5), CONCATENATE(LEFT(Table1[Flight No Column], 2), RIGHT(Table1[Flight No Column], 3)))
The length (LEN) function needs to return a value before it can be compared to another number. This is how it should be:
Column 2 = IF(LEN(Table1[Flight No Column]) =11, RIGHT(Table1[Flight No Column], 5), CONCATENATE(LEFT(Table1[Flight No Column], 2), RIGHT(Table1[Flight No Column], 3)))