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

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Gopinath_iyer
Helper II
Helper II

filter out upper level data

Dear Friends,

 

I am new to power bi and struct with a case. Hope to get some inputs here.

i will try to explain...let say we have employees data of an organization.

 

i have created simple table with employee name, age, salary and i want give a filter for employee selection to the user.

basis the user selection i want to filter out the upper level employees. e.g if C reports to B and B reports to A.

 

if user select A in filter we will see 3 rows A,B and C

if user selects B in filter we should see 2 rows B and C

if user selects C in filter we should only see 1 row C

 

thanks in advance 

Gopi

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

Hi  @Gopinath_iyer ,

 

Create a slicer table as below:

Table 2 = VALUES('Table'[employee name ])

Then create 2 measures as below:

_employee name = SWITCH(SELECTEDVALUE('Table 2'[employee name ]),
"A",CALCULATE(MAX('Table'[employee name ]),'Table'[employee name ] in FILTERS('Table'[employee name ])),
"B",CALCULATE(MAX('Table'[employee name ]),'Table'[employee name ] in FILTERS('Table'[employee name ])&&'Table'[employee name ]<>"A"),
"C",CALCULATE(MAX('Table'[employee name ]),FILTER(ALL('Table'),'Table'[employee name ]="C")))
_age = 
var age=CALCULATETABLE(VALUES('Table'[age]),FILTER(ALL('Table'),'Table'[employee name ]=[_employee name]))
Return
IF(MAX('Table'[age]) in age,MAX('Table'[age]),BLANK())

And you will see:

v-kelly-msft_0-1606379425484.png

v-kelly-msft_1-1606379440366.pngv-kelly-msft_2-1606379450412.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

 

View solution in original post

2 REPLIES 2
Gopinath_iyer
Helper II
Helper II

Hi 

 

Sorry for replying so late.

 

Thanks for the solution...but the real data has many names, in this solution emp names are hard coded.

 

Can we make it dynamic?

 

regards,

Gopi

 

 

v-kelly-msft
Community Support
Community Support

Hi  @Gopinath_iyer ,

 

Create a slicer table as below:

Table 2 = VALUES('Table'[employee name ])

Then create 2 measures as below:

_employee name = SWITCH(SELECTEDVALUE('Table 2'[employee name ]),
"A",CALCULATE(MAX('Table'[employee name ]),'Table'[employee name ] in FILTERS('Table'[employee name ])),
"B",CALCULATE(MAX('Table'[employee name ]),'Table'[employee name ] in FILTERS('Table'[employee name ])&&'Table'[employee name ]<>"A"),
"C",CALCULATE(MAX('Table'[employee name ]),FILTER(ALL('Table'),'Table'[employee name ]="C")))
_age = 
var age=CALCULATETABLE(VALUES('Table'[age]),FILTER(ALL('Table'),'Table'[employee name ]=[_employee name]))
Return
IF(MAX('Table'[age]) in age,MAX('Table'[age]),BLANK())

And you will see:

v-kelly-msft_0-1606379425484.png

v-kelly-msft_1-1606379440366.pngv-kelly-msft_2-1606379450412.png

 

For the related .pbix file,pls see attached.

 

Best Regards,
Kelly

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

 

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.