Add dash in text field in Power Bi / Powerquery - powerbi

I have a column in PowerBi namend X-rates. The value in the column is for example X00360. I want to change that value to X-00360. So after the X i need "-" sign.
In Excel i used iferror(CONCATENATE(left(O2;1));"-";right(O2;lenght(O2)-1));"")
but how to do this in powerquery?
X-rates (current) X-ratesNew (expected)
X00360 X-00360

Add a new column and type in
Text.Start([#"X-rates (current) "],1) & "-" & Text.Middle([#"X-rates (current) "], 1)

In powerquery, add column, custom column with formula
= Text.ReplaceRange([#"X-rates"], 0, 1, Text.Start([#"X-rates"],1)&"-")

Related

Vlookup or better alternative for retrieving column D into Column N if C contains

CONTEXT
Sheet 1, Column L has a combination of numbers and letters (internal reference) - e.g. 32948/78TPL
Sheet 2, Column C CONTAINS Column L (sheet1) - e.g. Payment proof for 32948/78TPL sent by Tom.
Sheet 2, Column D contains time/date
WHAT I WOULD LIKE TO ACHIEVE
Retrive on Sheet 1 Column N, the value of Column D where Column C (both from Sheet2) contains the value of Column L (sheet1)
Basically retrieve the time/date column from Sheet 2 for the correct row on Sheet1
WHAT I'VE TRIED
VLOOKUP("*"&$L7&"*",(Sheet12!C2:F),{3},false),"")
WHAT HAPPENS
It does return the correct value but works only for that row
If I change to VLOOKUP("*"&$L7:$L&"*",(Sheet12!C2:F),{3},false),"") it returns some strange values like "43984.76019" where the time/date cell should return values like "6/2/2020 18:14:40". So the range can't be assigned like that and probably the problem is trying to use a range with wildcards which I think it's not possible
If I manually stretch the formula (1st version) it returns wrong values for rows where Column L is empty
Is VLOOKUP the way to go?
Can someone please point me to a better direction?
Thanks in advance.
try:
=ARRAYFORMULA(IFNA(VLOOKUP(L2:L, {REGEXEXTRACT(Sheet2!C2:C,
TEXTJOIN("|", 1, L2:L)), Sheet2!D2:D}, 2, 0)))

Findout a particular letter in a column. once found i need output of the word in a new column - PowerBI

Input
Customera, c-customerrb, b-customerc
Ouput
c-customerrb
Here Customera, c-customerrb, b-customerc is a value of a cell.
I need to find out in each cell of column "C-". If the value found. it shuould return value as "C-customerrb"
Create a Calculated column
Column = IF(CONTAINSSTRINGEXACT(Search column,"search string"),search column,"")

Remove "%" sign from Column in PowerBI table

I have a column (datatype = deciaml, format = percentage) in a table visual.
But it displays "%" along with value.
Is there any way to remove this sign but the value should remain as it is (should remain in decimal format) ?
Current : 2.55%
Expected : 2.55
Measure1 =
ROUND(FORMAT(SELECTEDVALUE('Table'[Column]),BLANK())*100,2)
Ok. Just found my answer. This will remove the % sign.

How to change index number of a column to specific words in PowerBI

I have a column in a table with 0s and 1s.
I would like to change 0 to 'Not Paying' and 1 for 'Paying' to make it more intuitive for my visuals.
What is the best way to do this?
Should I create a new table, create a new column, or any other idea ?
It depends if you want a new column o transform it.
Go to Edit Queries. Then you can right click on the column and look for "Replace Values".
With that option you can replace some text to another one.
If the option is not available, first you have to change the type of the column to "text".
Regards,
Just create a calculated column using the following DAX:
New Column :=
SWITCH (
TRUE (),
'Table'[Old Column] = 0, "Not Paying",
'Table'[Old Column] = 1, "Paying"
)

M query - Edit the value of cell H2 in a table

Having imported an excel sheet into power query, I need to tidy it up by changing the value of a particular cell.
At the moment that cell has a null value, but there are other null values in the same column that I do not want to change. – So I cannot replace all of the null values in that column with another value.
I also cannot correct that particular cell in the source excel file (there are hundreds of them, which were created before I arrived).
I basically need some syntax for example that sets the value of cell H2 to “Jeep”, but not to change any other cells.
Very grateful for any insight.
One way would be:
In the Power Query Editor:
Add an index column starting from 1 (tab Add Column)
Add a Conditional column: If [Index] = 2 then Jeep else [H] (tab Add Column)
Delete Index column and [H] Column
Rename Custom column to [H].