The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a map which feeds off TableA, using latitude and longitude. I want to filter the map so it only returns values where the data was entered by a subordinate of the manager who is using the page, using USERPRINCIPALNAME() to check their employee number (emp no) against a table called 'Employee - Main Data'
Solved! Go to Solution.
Hi @Singularity9 ,
Thank you for reaching out to the Microsoft Community Forum.
Please follow below steps.
1. Created two tables (Employee, Table) with sample data, please refer below snap.
2. Created "Supervisor_Path" column in Employee table with below DAX.
Supervisor_Path = PATH('Employee'[Emp No], 'Employee'[Supervisor Search])
3. Created "Is_Subordinate_Measure" measure that checks whether a row is from a subordinate
If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.
Thank you
Hi @Singularity9 ,
Thank you for reaching out to the Microsoft Community Forum.
Please follow below steps.
1. Created two tables (Employee, Table) with sample data, please refer below snap.
2. Created "Supervisor_Path" column in Employee table with below DAX.
Supervisor_Path = PATH('Employee'[Emp No], 'Employee'[Supervisor Search])
3. Created "Is_Subordinate_Measure" measure that checks whether a row is from a subordinate
If my response has resolved your query, please mark it as the "Accepted Solution" to assist others. Additionally, a "Kudos" would be appreciated if you found my response helpful.
Thank you
This worked, thank you! I had to remove the relationship between the two tables and modify other measures to account for that, but the end result is working well.
There are a few ways you could set this up, with logic similar to what you posted above.
Here's one example (PBIX attached with dummy data):
1. I would recommend storing the path in a calculated column (for performance reasons):
Employee Path =
PATH ( 'Employee - Main Data'[Emp No], 'Employee - Main Data'[Supervisor Search] )
2. Relationship between 'Employee - Main Data'[Emp No]
& TableA[Emp No]
(1-to-many)
3. The measure for filtering the map visual could then be this (filtered equal to 1 on the map visual):
Subordinate Location Flag =
VAR CurrentEmpNo =
LOOKUPVALUE ( 'Employee - Main Data'[Emp No], 'Employee - Main Data'[Email Address], USERPRINCIPALNAME() )
VAR SubordinateLocationFlag =
CALCULATE (
INT ( NOT ISEMPTY ( TableA ) ),
KEEPFILTERS (
PATHCONTAINS ( 'Employee - Main Data'[Employee Path], CurrentEmpNo )
),
KEEPFILTERS ( 'Employee - Main Data'[Emp No] <> CurrentEmpNo )
)
RETURN
SubordinateLocationFlag
I created a couple of similar measures to format the Employee table visual for demo purposes.
You could use a calculation group if you need to apply the filtering logic more widely.
Is this the sort of thing you were looking for?