Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more.
Get startedGrow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.
Hi!
I have two types of data from my electricity meter in one column. You can find an example of what the table looks like in the first table below. I would like to have the data of the meter split into two columns, like in the second table.
Does anyone have a solution for this?
Kinds regards!
Date/Time | Meter 1_2 |
26-10-2020 01:00 | 200 |
26-10-2020 02:00 | 215 |
26-10-2020 03:00 | 220 |
26-10-2020 04:00 | 50 |
26-10-2020 05:00 | 55 |
26-10-2020 06:00 | 225 |
26-10-2020 07:00 | 60 |
26-10-2020 08:00 | 230 |
26-10-2020 09:00 | 65 |
Date/Time | Meter 1 | Meter 2 |
26-10-2020 01:00 | 200 | 50 |
26-10-2020 02:00 | 215 | 50 |
26-10-2020 03:00 | 220 | 50 |
26-10-2020 04:00 | 220 | 50 |
26-10-2020 05:00 | 220 | 55 |
26-10-2020 06:00 | 225 | 55 |
26-10-2020 07:00 | 225 | 60 |
26-10-2020 08:00 | 230 | 60 |
26-10-2020 09:00 | 230 | 65 |
Solved! Go to Solution.
Hello @kruizing
what is the logic of the split?
How do you get at the data of 01:00 from this
to this?
the only logic I found is this... but I don't know if suits
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Zcy7CcAwDIThVYJqG6RzpDxWMd5/DRusFOGaaz7u710Q1bRCoYfaqypFsHaUPyHJnKglgV/nJmfxFM7Fl2O6NgXn7jw1pidPKzcm", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date/Time" = _t, #"Meter 1_2" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date/Time", type datetime}, {"Meter 1_2", Int64.Type}}),
TransfromMeter = Table.TransformColumns
(
#"Changed Type",
{
{
"Meter 1_2",
each if _>100 then Text.From(_)&",0" else "0,"&Text.From(_)
}
}
),
#"Split Column by Delimiter" = Table.SplitColumn(TransfromMeter, "Meter 1_2", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Meter 1_2.1", "Meter 1_2.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Meter 1_2.1", Int64.Type}, {"Meter 1_2.2", Int64.Type}}),
#"Replaced Value" = Table.ReplaceValue(#"Changed Type1",0,null,Replacer.ReplaceValue,{"Meter 1_2.1", "Meter 1_2.2"}),
#"Filled Down" = Table.FillDown(#"Replaced Value",{"Meter 1_2.1"}),
#"Filled Up" = Table.FillUp(#"Filled Down",{"Meter 1_2.2"})
in
#"Filled Up"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Hello @kruizing
what is the logic of the split?
How do you get at the data of 01:00 from this
to this?
the only logic I found is this... but I don't know if suits
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("Zcy7CcAwDIThVYJqG6RzpDxWMd5/DRusFOGaaz7u710Q1bRCoYfaqypFsHaUPyHJnKglgV/nJmfxFM7Fl2O6NgXn7jw1pidPKzcm", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Date/Time" = _t, #"Meter 1_2" = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Date/Time", type datetime}, {"Meter 1_2", Int64.Type}}),
TransfromMeter = Table.TransformColumns
(
#"Changed Type",
{
{
"Meter 1_2",
each if _>100 then Text.From(_)&",0" else "0,"&Text.From(_)
}
}
),
#"Split Column by Delimiter" = Table.SplitColumn(TransfromMeter, "Meter 1_2", Splitter.SplitTextByDelimiter(",", QuoteStyle.Csv), {"Meter 1_2.1", "Meter 1_2.2"}),
#"Changed Type1" = Table.TransformColumnTypes(#"Split Column by Delimiter",{{"Meter 1_2.1", Int64.Type}, {"Meter 1_2.2", Int64.Type}}),
#"Replaced Value" = Table.ReplaceValue(#"Changed Type1",0,null,Replacer.ReplaceValue,{"Meter 1_2.1", "Meter 1_2.2"}),
#"Filled Down" = Table.FillDown(#"Replaced Value",{"Meter 1_2.1"}),
#"Filled Up" = Table.FillUp(#"Filled Down",{"Meter 1_2.2"})
in
#"Filled Up"
Copy paste this code to the advanced editor in a new blank query to see how the solution works.
If this post helps or solves your problem, please mark it as solution (to help other users find useful content and to acknowledge the work of users that helped you)
Kudoes are nice too
Have fun
Jimmy
Ask questions in Eventhouse and KQL, Eventstream, and Reflex.
Check out the May 2024 Power BI update to learn about new features.