Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I am trying create a new column in a table based on [fpartno] where:
- if the 14th digit of the [fpartno] is F, the value in the new column should show "RC_FP"
- if the 14th digit of the [fpartno] is R, the value in the new column should show "RC_RP"
- and if the 14th digit is neither, then the new column should be empty.
I created this:
Solved! Go to Solution.
Ah, of course. I did not realize at first sight. What you are doing is looking for the position of the first R or first F. And that can be before the position 14 (even if there's an "R" at position 14) What you actually need is to extract the character in position 14 and then check if it is an R or an F:
cRCtest V2 =
SWITCH (
RIGHT ( LEFT ( dbMfgUnits[fpartno], 14 ), 1 ),
"R", "RC_FP",
"F", "RC_RP"
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Ah, of course. I did not realize at first sight. What you are doing is looking for the position of the first R or first F. And that can be before the position 14 (even if there's an "R" at position 14) What you actually need is to extract the character in position 14 and then check if it is an R or an F:
cRCtest V2 =
SWITCH (
RIGHT ( LEFT ( dbMfgUnits[fpartno], 14 ), 1 ),
"R", "RC_FP",
"F", "RC_RP"
)
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Thank you! That worked!
Hi @alittle1
Your code looks sound. Can you share some data with examples where it does not work?
Please mark the question solved when done and consider giving a thumbs up if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Value
0P9RC15A25020R0-FSC: expected result "RC-RP"; actual result = empty field
0P9RC17L50160FS-FXC-03: expected result "RC-FP"; actual result "RC-FP"
0P9RC22A25050R0-XSC: expected result "RC-RP"; actual result = empty field
0P9RC22A75020F2-FSC-C01: expected result "RC-FP"; actual result "RC-FP"
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.