Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
Anonymous
Not applicable

Grouping Hierarchy

So I have a column which has the following

1

1.1

1.1.1

1.1.2

1.1.2.1

1.1.2.1.2

1.2

1.2.1

1.3

 

i want to create a hierarchy so that when i click on 1, the next level would open which would be 1.1

In turn, everything associated with the 1.1 (1.1.1 and 1.1.2) would be next on the hierarchy and so on.

I'm wondering how to go about this?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hello @Anonymous,

Personally i would go about this using the PATH() Function to use this function you need to replace the "." with "|". Next you want to create a column for every possible outcome of the hierarchy. In your case it would look like the following:

 

10b73f2d627473ad866d361d05e50ae4

 

Path 5 = 
VAR PathLen = PATHLENGTH('Table'[Column1])
VAR Delimiter = "."
RETURN
IF(PathLen >= 5; 
 'Table'[Path 4]&Delimiter&PATHITEM('Table'[Column1];5;TEXT);BLANK())

Path 4 =
VAR PathLen =
    PATHLENGTH ( 'Table'[Column1] )
VAR Delimiter = "."
RETURN
    IF (
        PathLen >= 4;
        'Table'[Path 3] & Delimiter
            & PATHITEM ( 'Table'[Column1]; 4; TEXT );
        BLANK ()
    )
 => Continue untill Path 2

Path 1 = 
 PATHITEM('Table'[Column1];1;TEXT)

 Kind regards
Joren Venema

Data & Analytics Consultant
If this reply solved your question be sure to mark this post as the solution to help others find the answer more easily.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hello @Anonymous,

Personally i would go about this using the PATH() Function to use this function you need to replace the "." with "|". Next you want to create a column for every possible outcome of the hierarchy. In your case it would look like the following:

 

10b73f2d627473ad866d361d05e50ae4

 

Path 5 = 
VAR PathLen = PATHLENGTH('Table'[Column1])
VAR Delimiter = "."
RETURN
IF(PathLen >= 5; 
 'Table'[Path 4]&Delimiter&PATHITEM('Table'[Column1];5;TEXT);BLANK())

Path 4 =
VAR PathLen =
    PATHLENGTH ( 'Table'[Column1] )
VAR Delimiter = "."
RETURN
    IF (
        PathLen >= 4;
        'Table'[Path 3] & Delimiter
            & PATHITEM ( 'Table'[Column1]; 4; TEXT );
        BLANK ()
    )
 => Continue untill Path 2

Path 1 = 
 PATHITEM('Table'[Column1];1;TEXT)

 Kind regards
Joren Venema

Data & Analytics Consultant
If this reply solved your question be sure to mark this post as the solution to help others find the answer more easily.

Anonymous
Not applicable

Works a treat and good to know the Path() and PathItem() function

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors