<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to get rid of blank row for power query hierarchy in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/How-to-get-rid-of-blank-row-for-power-query-hierarchy/m-p/4788998#M62548</link>
    <description>&lt;P&gt;No way of doing this&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/845241"&gt;@v-prasare&lt;/a&gt;&amp;nbsp;.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-can-I-reduce-blank-rows-in-a-hierarchical-setup-in-my/td-p/3775903" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-can-I-reduce-blank-rows-in-a-hierarchical-setup-in-my/td-p/3775903&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://radacad.com/removing-blanks-from-organizational-ragged-hierarchy-in-power-bi-matrix-visual/" target="_blank"&gt;https://radacad.com/removing-blanks-from-organizational-ragged-hierarchy-in-power-bi-matrix-visual/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Jacek&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 06 Aug 2025 13:17:18 GMT</pubDate>
    <dc:creator>jaryszek</dc:creator>
    <dc:date>2025-08-06T13:17:18Z</dc:date>
    <item>
      <title>How to get rid of blank row for power query hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-get-rid-of-blank-row-for-power-query-hierarchy/m-p/4783076#M62440</link>
      <description>&lt;P&gt;This is my table:&lt;BR /&gt;&lt;BR /&gt;Employee IDManager IDEmployeeManagerCleanPathPathLevel1Level2Level3&lt;/P&gt;&lt;TABLE&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;/TD&gt;&lt;TD&gt;Kaylie S&lt;/TD&gt;&lt;TD&gt;Pam H&lt;/TD&gt;&lt;TD&gt;1010&lt;/TD&gt;&lt;TD&gt;1010|1011|1014&lt;/TD&gt;&lt;TD&gt;1010&lt;/TD&gt;&lt;TD&gt;1011&lt;/TD&gt;&lt;TD&gt;1014&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1015&lt;/TD&gt;&lt;TD&gt;1012&lt;/TD&gt;&lt;TD&gt;Mike O&lt;/TD&gt;&lt;TD&gt;Guy L&lt;/TD&gt;&lt;TD&gt;1010&lt;/TD&gt;&lt;TD&gt;1010|1012|1015&lt;/TD&gt;&lt;TD&gt;1010&lt;/TD&gt;&lt;TD&gt;1012&lt;/TD&gt;&lt;TD&gt;1015&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;1016&lt;/TD&gt;&lt;TD&gt;1012&lt;/TD&gt;&lt;TD&gt;Rudy Q&lt;/TD&gt;&lt;TD&gt;Guy L&lt;/TD&gt;&lt;TD&gt;1010&lt;/TD&gt;&lt;TD&gt;1010|1012|1016&lt;/TD&gt;&lt;TD&gt;1010&lt;/TD&gt;&lt;TD&gt;1012&lt;/TD&gt;&lt;TD&gt;1016&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I created it using power query code. It is recursive hierarchy.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Now i want to get rid of blanks on matrix/slicer for all levels.&amp;nbsp;&lt;BR /&gt;I could filter them but generally it can be problematic becuase imagine that i have 20 levels.&amp;nbsp;&lt;BR /&gt;What in this case? Manually go and show all of them?&lt;BR /&gt;&lt;BR /&gt;Code used:&lt;/P&gt;&lt;P&gt;Main query:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMjQwNFDSUQKioPxKBTcIEywYqwOWNYTxdZQCEnMVPJBUgoRrwEqgao0Qat1LKxV8sKg1gqk1hggagtWkpxYp+CLZAFNkglDknViZk5mqEIxFlSlEFch238zsVAV/JPthaswQaoJKUyoVAlHUxAIA", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Employee ID" = _t, #"Manager ID" = _t, Employee = _t, Manager = _t, Path = _t]),
    #"Removed Columns" = Table.RemoveColumns(Source,{"Path"}),
    #"Changed Type" = Table.TransformColumnTypes(#"Removed Columns",{{"Employee ID", Int64.Type}, {"Manager ID", Int64.Type}}),
    CleanPath= Table.AddColumn(#"Changed Type", 
                            "CleanPath", each 
                                   fnGetPathHierarchyWorking("Employee ID", "Manager ID", [Manager ID], #"Changed Type")),
    AddRemoveItems = Table.AddColumn(CleanPath, "Path", 
        each 
            let 
                a = List.RemoveItems(Text.Split(_[CleanPath], "|"), {""}),
                b = List.Reverse(a) ,
                c  = 
                    if _[Manager ID] = null or _[Manager ID] = "" 
                    then Text.From(_[Employee ID])
                    else Text.Combine(List.Transform(b, Text.From) &amp;amp; List.Transform({_[Manager ID], _[Employee ID]}, Text.From), "|")
            in c),
    AddLevels = fnAddLevelsWorking(AddRemoveItems, "Path")
    // Path2 = Table.AddColumn(AddRemoveItems, "Path2", each fnGetHierarchyImproved("Employee ID", "Manager ID", _, AddRemoveItems))
in
    AddLevels&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Adding "Levels" columns dynamically:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(inputTable as table, pathCol as text) as table =&amp;gt;
let
    // Add PathList column by splitting the path
    AddPathList = Table.AddColumn(
        inputTable,
        "PathList",
        each Text.Split(Record.Field(_, pathCol), "|")
    ),

    MaxLevel = List.Max(List.Transform(AddPathList[PathList], each List.Count(_))),

    LevelColumns = List.Transform({1..MaxLevel}, each "Level" &amp;amp; Text.From(_)),

    AddLevels = List.Accumulate(
        LevelColumns,
        AddPathList,
        (state, current) =&amp;gt;
            Table.AddColumn(
                state,
                current,
                (row) =&amp;gt;
                    let
                        idx = Number.From(Text.Range(current, 5)) - 1,
                        pathList = row[PathList]
                    in
                        if idx &amp;lt; List.Count(pathList) then pathList{idx} else null
            )
    ),

    Result = Table.RemoveColumns(AddLevels, {"PathList"})
in
    Result&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Hierarchy code:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    fnGetPathHierarchyFinal = (childCol as text, parentCol as text, currentRow as record, sourceTable as table) as text =&amp;gt;
        let
            parentValue = Record.Field(currentRow, parentCol),
            childValue =  Record.Field(currentRow, childCol),
            rawPath = fnGetPathHierarchyWorking(childCol, parentCol, parentValue, sourceTable),
            cleanedList = List.RemoveItems(Text.Split(rawPath, "|"), {""}),
            reversed = List.Reverse(cleanedList),
            fullPath = 
                if parentValue = null or parentValue = "" 
                then Text.From(childValue)
                else Text.Combine(List.Transform(reversed, Text.From) &amp;amp; List.Transform({parentValue, childValue}, Text.From), "|")
        in
            fullPath
in
    fnGetPathHierarchyFinal&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Recursive Hierarchy:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;let
    fnGetPathHierarchy = (childCol as text, parentCol as text, currentParent as any, sourceTable as table) as text =&amp;gt;
        let
            mylist = Table.Column(Table.SelectRows(sourceTable, each Record.Field(_, childCol) = currentParent), parentCol),
            result = Text.Combine(List.Transform(mylist, Text.From))
        in
            Text.TrimEnd(
                if result = "" then ""
                else @result &amp;amp; "|" &amp;amp; @fnGetPathHierarchy(childCol, parentCol, result, sourceTable),
                "|"
            )
in
    fnGetPathHierarchy&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;1. How to get rid of blanks with ease from slicer/matrix?&amp;nbsp;&lt;BR /&gt;2. How to automatically add new levels of hierarchy?&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Jacek&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 31 Jul 2025 13:45:07 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-get-rid-of-blank-row-for-power-query-hierarchy/m-p/4783076#M62440</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2025-07-31T13:45:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of blank row for power query hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-get-rid-of-blank-row-for-power-query-hierarchy/m-p/4783663#M62447</link>
      <description>&lt;P&gt;There's no need for any of this. All you need is to blank out the parent value for the top entries in the hierarchy.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2025 01:19:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-get-rid-of-blank-row-for-power-query-hierarchy/m-p/4783663#M62447</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2025-08-01T01:19:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of blank row for power query hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-get-rid-of-blank-row-for-power-query-hierarchy/m-p/4783996#M62456</link>
      <description>&lt;P&gt;Thanks, hmm interesting.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;So how to make this working?&amp;nbsp;&lt;BR /&gt;&lt;SPAN&gt;You are saying that Level1 should be empty?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Aug 2025 08:02:45 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-get-rid-of-blank-row-for-power-query-hierarchy/m-p/4783996#M62456</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2025-08-01T08:02:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of blank row for power query hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-get-rid-of-blank-row-for-power-query-hierarchy/m-p/4788949#M62545</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/107617"&gt;@jaryszek&lt;/a&gt;,&lt;/P&gt;
&lt;P data-start="157" data-end="202"&gt;To better assist you, could you please share:&lt;/P&gt;
&lt;UL data-start="204" data-end="411"&gt;
&lt;LI data-start="204" data-end="288"&gt;
&lt;P data-start="206" data-end="288"&gt;A sample .pbix file that reproduces the issue or demonstrates your scenario.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI data-start="289" data-end="411"&gt;
&lt;P data-start="291" data-end="411"&gt;The expected outcome, such as a screenshot, an Excel file, or a brief explanation of what you'd like to see.&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P data-start="413" data-end="500"&gt;This will help us understand your requirement clearly and provide an accurate solution.&lt;/P&gt;
&lt;P data-start="413" data-end="500"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="413" data-end="500"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="413" data-end="500"&gt;Thanks,&lt;/P&gt;
&lt;P data-start="413" data-end="500"&gt;Prashanth Are&lt;/P&gt;
&lt;P data-start="413" data-end="500"&gt;MS fabric community support&lt;/P&gt;</description>
      <pubDate>Wed, 06 Aug 2025 12:37:48 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-get-rid-of-blank-row-for-power-query-hierarchy/m-p/4788949#M62545</guid>
      <dc:creator>v-prasare</dc:creator>
      <dc:date>2025-08-06T12:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get rid of blank row for power query hierarchy</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/How-to-get-rid-of-blank-row-for-power-query-hierarchy/m-p/4788998#M62548</link>
      <description>&lt;P&gt;No way of doing this&amp;nbsp;&lt;a href="https://community.fabric.microsoft.com/t5/user/viewprofilepage/user-id/845241"&gt;@v-prasare&lt;/a&gt;&amp;nbsp;.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://community.fabric.microsoft.com/t5/Desktop/How-can-I-reduce-blank-rows-in-a-hierarchical-setup-in-my/td-p/3775903" target="_blank"&gt;https://community.fabric.microsoft.com/t5/Desktop/How-can-I-reduce-blank-rows-in-a-hierarchical-setup-in-my/td-p/3775903&lt;/A&gt;&lt;BR /&gt;&lt;A href="https://radacad.com/removing-blanks-from-organizational-ragged-hierarchy-in-power-bi-matrix-visual/" target="_blank"&gt;https://radacad.com/removing-blanks-from-organizational-ragged-hierarchy-in-power-bi-matrix-visual/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Jacek&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Aug 2025 13:17:18 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/How-to-get-rid-of-blank-row-for-power-query-hierarchy/m-p/4788998#M62548</guid>
      <dc:creator>jaryszek</dc:creator>
      <dc:date>2025-08-06T13:17:18Z</dc:date>
    </item>
  </channel>
</rss>

