Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
4 years ago

Need help in filtering data - show only if USERPRINCIPALNAME matches the group of users(topmanagers)

Hi!

 

I have the below table wherein only the TopManagers people can see this data - I tried the following Measures:

 

  • FilterByTopManagers = IF(CONTAINSROW({USERPRINCIPALNAME()},selectedvalue(TimeReport[TopManagers])),1,0)
  • FilterByTopManagers = IF(SELECTEDVALUE(TimeReport[TopManagers]) IN {USERPRINCIPALNAME()},0,1)
  • Table = FILTER(TimeReport, TimeReport[Title] = USERPRINCIPALNAME())

You help/suggestion would be appreciated - thanks.

 

FunctionDepartmentCityRevenueTopManagers
TDSalesPune1M[email protected]; [email protected]; [email protected]
ADHRMumbai2M[email protected]; [email protected]; [email protected]
TIDProcurementDelhi3M[email protected]; [email protected]

 

 

 

 

3 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi Amit,

       

      I gave it a try however it doesn't look optimal - TopManagers values get split into columns so it can be 2 or 3 or 5 columns as I am getting the Top Managers of a user dynamically as per the Organization Chart.

      Therefore evaluating how many top managers would a user have and then querying all these columns would be tedious hence dropping this idea.

  • Anonymous's avatar
    Anonymous
    Not applicable

    I have tried to get the data with the below Dax query - it is working however getting filtered with the current logged in user.

    What I want is: If TopManagers equal or contains USERPRINCIPALNAME() then show all data.
    Using SQL it would be: SELECT * FROM TimeReport WHERE TimeReport[TopManagers] IN (USERPRINCIPALNAME())

     

    New Table =
    CALCULATETABLE (
    SELECTCOLUMNS (
    TimeReport,
    "Neukunden_Akquise_Systeme", TimeReport[Neukunden_Akquise_Systeme],
    "Neukunden_Akquise_Produkte", TimeReport[Neukunden_Akquise_Produkte],
    "User Name", TimeReport[User Name]
    ),
    CONTAINSSTRING(TimeReport[TopManagers], "[email protected]")
    )