Forum Discussion

Gopinath_iyer's avatar
Gopinath_iyer
Icon for Helper II rankHelper II
5 years ago
Solved

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 tabl...
  • v-kelly-msft's avatar
    5 years ago

    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:

     

    For the related .pbix file,pls see attached.

     

    Best Regards,
    Kelly

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