March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
Hope someone can help with this.
I've got a column in Power BI that has aircraft registrations but they are without the required dash separator as shown the screenshot
What I would like to be able to do is create another column and have some way of adding the dash in but based on certain criteria depending on the registration. E.g.
If Regno starts with OOxxx then OO-xxx
If Regno starts with Dxxxx then D-xxxx
If Regno start with YUxxx then YU-xxx
and so on..
Tried conditional columns but that doesn't work. Was thinking along the lines of a custom column that inserts a dash but this inserts the dash at an arbutry position and not depending on the type of registration condition:
= Table.AddColumn(#"Changed Type1", "Custom2", each Text.Insert(Text.From([REGNO]),2,"-"))
Any thoughts or suggestions would be much appreciated
Solved! Go to Solution.
Hi @mkwiatkowski ,
You can try to create a new column like below:
Column =
var left_1 = LEFT('Table'[Regno],1)
var left_2 = LEFT('Table'[Regno],2)
VAR right_1 = SUBSTITUTE('Table'[Regno],left_1,"")
var right_2 = SUBSTITUTE('Table'[Regno],left_2,"")
return SWITCH(TRUE(),
left_1 IN {"D","L"},COMBINEVALUES ( "-", left_1, right_1 ),
left_2 IN {"OO","YU"},COMBINEVALUES ( "-", left_2, right_2 ))
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @mkwiatkowski ,
You can try to create a new column like below:
Column =
var left_1 = LEFT('Table'[Regno],1)
var left_2 = LEFT('Table'[Regno],2)
VAR right_1 = SUBSTITUTE('Table'[Regno],left_1,"")
var right_2 = SUBSTITUTE('Table'[Regno],left_2,"")
return SWITCH(TRUE(),
left_1 IN {"D","L"},COMBINEVALUES ( "-", left_1, right_1 ),
left_2 IN {"OO","YU"},COMBINEVALUES ( "-", left_2, right_2 ))
Best Regards,
Liang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
134 | |
90 | |
90 | |
66 | |
58 |
User | Count |
---|---|
201 | |
137 | |
107 | |
70 | |
68 |