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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
pra137
Helper III
Helper III

How to show hierarchy result in matrix

Hello guys, 

I want to show the hierarchical data in matrix visual,like manager name under that sales persons of that manager and I also want to see manager's data how to show that..below is my sample data 

Manager name  sales person 

A                            B

B                             c

A                            F

C                            G

A                            H

F                             A

I want matrix like

Manager name

A

    A

    B

    F

   H

Please help 

1 ACCEPTED SOLUTION
v-yanjiang-msft
Community Support
Community Support

Hi @pra137 ,

According to your description, here’s my sample data.

vkalyjmsft_0-1639045400928.png

Method1

In this case, Manager cannot join his own scope according to the data structure.

vkalyjmsft_1-1639045400931.png

You can add a measure to calculate the value of manager separately.

Measure =
VAR _MANAGE =
    CALCULATETABLE ( VALUES ( 'Table (2)'[Manager name] ), ALL ( 'Table (2)' ) )
RETURN
    IF (
        MAX ( 'Table (2)'[Sales person] ) IN _MANAGE,
        SUM ( 'Table (2)'[Sales] ),
        BLANK ()
    )

vkalyjmsft_4-1639045835533.png

Method2

Change the data source or create a new table in order to achieve the desired result.

Copy 1to 2 and 3, copy 4 to 5.

vkalyjmsft_2-1639045400936.png

 

Put Manager name and Sales person to rows and put Sales to values, then get the expected result.

vkalyjmsft_3-1639045400938.png

I attach my sample below for reference.

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
v-yanjiang-msft
Community Support
Community Support

Hi @pra137 ,

According to your description, here’s my sample data.

vkalyjmsft_0-1639045400928.png

Method1

In this case, Manager cannot join his own scope according to the data structure.

vkalyjmsft_1-1639045400931.png

You can add a measure to calculate the value of manager separately.

Measure =
VAR _MANAGE =
    CALCULATETABLE ( VALUES ( 'Table (2)'[Manager name] ), ALL ( 'Table (2)' ) )
RETURN
    IF (
        MAX ( 'Table (2)'[Sales person] ) IN _MANAGE,
        SUM ( 'Table (2)'[Sales] ),
        BLANK ()
    )

vkalyjmsft_4-1639045835533.png

Method2

Change the data source or create a new table in order to achieve the desired result.

Copy 1to 2 and 3, copy 4 to 5.

vkalyjmsft_2-1639045400936.png

 

Put Manager name and Sales person to rows and put Sales to values, then get the expected result.

vkalyjmsft_3-1639045400938.png

I attach my sample below for reference.

Best Regards,
Community Support Team _ kalyj

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hello @v-yanjiang-msft 

Whenever we apply RLS on Method 2 solution, I mean when Manager A will log in to report. He is seeing manager A data and also Manager F data with sales person A..which is not correct I only want to show Manager A data..Is it possible..?

Hi @pra137 ,

F is shown under the manager A is because F is a sales person of manager A in your sample.

vkalyjmsft_0-1640049850377.png

Best Regards,
Community Support Team _ kalyj

Hello @v-yanjiang-msft 

How to copy data as u shown in method 2 with live data..?

MFelix
Super User
Super User

Hi @pra137 ,

 

Believe that for this you need to use the Parent Child hiererchy check the link below:

https://www.daxpatterns.com/parent-child-hierarchies/


Regards

Miguel Félix


Did I answer your question? Mark my post as a solution!

Proud to be a Super User!

Check out my blog: Power BI em Português



Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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