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.
Hi, I want to get a integer column baseed this column:
column
W+2
W-5
W-6
W
W+1
and expected result:
2
-5
-6
0
1
do you have any solutions?
Solved! Go to Solution.
Hi @Anonymous,
According with you sample data you only need to do the following steps in Power Query:
Solution in DAX:
Add the following column:
Column =
IF('Table'[Data]="W",
"0",
REPLACE('Table'[Data],1,1,"")
)
Check the pbi in attach with an example.
ID =
VAR _табл. =
ДОБАВИТЬ КОЛОННЫ (
GENERATE (GENERATESERIES (1, 9, 1), VALUES (tbl[serial])),
"я бы",
ЕСЛИ ОШИБКА (
СТОИМОСТЬ (
IF (CONTAINSSTRING ([серийный номер], "-" ), "-" ) & MID ( [серийный номер], [значение], 1 )
),
ПУСТОЙ ()
)
)
VAR _Результат =
СЦЕПИТЬ ( _tbl, [id], "" )
ВОЗВРАЩАТЬСЯ
ЕСЛИ (HASONEVALUE ('tbl'[serial]), ЕСЛИ (_Result = "", "0", _Result))
ID =
VAR _табл. =
ДОБАВИТЬ КОЛОННЫ (
GENERATE (GENERATESERIES (1, 9, 1), VALUES (tbl[serial])),
"я бы",
ЕСЛИ ОШИБКА (
СТОИМОСТЬ (
IF (CONTAINSSTRING ([серийный номер], "-" ), "-" ) & MID ( [серийный номер], [значение], 1 )
),
ПУСТОЙ ()
)
)
VAR _Результат =
СЦЕПИТЬ ( _tbl, [id], "" )
ВОЗВРАЩАТЬСЯ
ЕСЛИ (HASONEVALUE ('tbl'[serial]), ЕСЛИ (_Result = "", "0", _Result))
Hello,
You could add a calculated column with this dax
If I answered your question, please mark my post as solution, Appreciate your Kudos👍
Proud to be a Super User! | |
Whatif the value is W+100 or W+1000, does any function can omit letter W?
Hi @Anonymous,
According with you sample data you only need to do the following steps in Power Query:
Solution in DAX:
Add the following column:
Column =
IF('Table'[Data]="W",
"0",
REPLACE('Table'[Data],1,1,"")
)
Check the pbi in attach with an example.
This column is calculated use DAX, so powerquery does not work
@Anonymous , check my solution in DAX in the first response.
in power query:
let
Source = Excel.Workbook(File.Contents("C:\Users\User\Desktop\serial.xlsx"), null, true),
Лист1_Sheet = Source{[Item="Лист1",Kind="Sheet"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Лист1_Sheet,{{"Column1", type text}}),
#"Promoted Headers" = Table.PromoteHeaders(#"Changed Type", [PromoteAllScalars=true]),
#"Changed Type1" = Table.TransformColumnTypes(#"Promoted Headers",{{"serial", type text}}),
#"Added Custom" = Table.AddColumn(#"Changed Type1", "ID", each Number.From(Text.Select([serial],{"-"})&
Text.Select([serial],{"1".."9"}))??0)
in
#"Added Custom"
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.
User | Count |
---|---|
107 | |
94 | |
75 | |
63 | |
62 |
User | Count |
---|---|
143 | |
104 | |
104 | |
80 | |
66 |