Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register 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.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
90 | |
87 | |
84 | |
68 | |
49 |
User | Count |
---|---|
131 | |
111 | |
96 | |
71 | |
67 |