Forum Discussion

Bunny25's avatar
Bunny25
Frequent Visitor
2 years ago
Solved

Power BI Tables

I have a table as per below format:

IncidentApplicationsDowntime Hours
001X
Y
5
002A
B
C
2
003A1
A2
A3
A4
3

 

How to conver to below in Power BI? With each row for the data in the column:

IncidentApplicationsDowntime Hours
001X5
001Y5
002A2
002B2
002C2
003A13
003A23
003A33
003A43
  • Hi,

    This one works

    let
        Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Incident", Int64.Type}, {"Applications", type text}, {"Downtime Hours", Int64.Type}}),
        #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"Applications", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Applications")
    in
        #"Split Column by Delimiter"

     

14 Replies

  • Daniel29195's avatar
    Daniel29195
    Community Champion

    before : 

     

    after : 

     

     

    if this is what you want, 

     

    then you can choose the column that you want to split, 

    and split to rows instead of columns in the power query 

     

     

    hope it helps

    Bunny25 

    • Bunny25's avatar
      Bunny25
      Frequent Visitor

      Good one... However after the last delimeter it add an extra row

      • Daniel29195's avatar
        Daniel29195
        Community Champion

        if it is a blank row, you can in power query , remove blank rows 

  • smpa01's avatar
    smpa01
    Community Champion

    Bunny25  can you try this

    let
        Source = {[colA=1,colB="A 
    B"],[colA=2,colB="X 
    Y
    Z"]},
        #"Expanded Column1" = Table.ExpandRecordColumn(Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error), "Column1", {"colA", "colB"}, {"colA", "colB"}),
        #"Added Custom" = Table.AddColumn(#"Expanded Column1", "Custom", each Text.Split([colB],"
    ")),
        #"Expanded Custom" = Table.ExpandListColumn(#"Added Custom", "Custom"),
        #"Removed Columns" = Table.RemoveColumns(#"Expanded Custom",{"colB"})
    in
        #"Removed Columns"
  • Hi,

    This one works

    let
        Source = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Incident", Int64.Type}, {"Applications", type text}, {"Downtime Hours", Int64.Type}}),
        #"Split Column by Delimiter" = Table.ExpandListColumn(Table.TransformColumns(#"Changed Type", {{"Applications", Splitter.SplitTextByDelimiter("#(lf)", QuoteStyle.Csv), let itemType = (type nullable text) meta [Serialized.Text = true] in type {itemType}}}), "Applications")
    in
        #"Split Column by Delimiter"

     

  • Open the table on power query and apply fill up or fill down (as per requirement).

  • Daniel29195's avatar
    Daniel29195
    Community Champion

    Hello,

    in power query , there is a feature called  : Fill 

    initial data : 

     

    after using fill

     

     

    NB :  you need to select the column and then apply the fill option