The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I would like to Filter BI-Reports using the Users Domain.
I am able to grab the User using Measure = Username()
I would have thought it simple to drag this Measure accross to Filter On All Pages and then add a simple if contains "DomainName" Filter my Table by Column [ClientName]. My [ClientName] includes the Clients Domain.
I dont need or require ROW level Security, just the ability to Filter using a Viewers Domain.
Thank You Kindly,
Jonathan
Solved! Go to Solution.
Hi @JonathanDavey1 ,
I have created a data sample and include the actual domain for "C".
Please try to create a measure, and apply it to visual-filter pane, set as "is 1":
Domain measure =
var _pos=FIND("\", USERNAME())
var _domain=LEFT(USERNAME(),_pos-1)
return IF(CONTAINSSTRING(MAX('Table'[Include domains]),_domain),1,0)
Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @JonathanDavey1 ,
This error is because USERNAME() show different formats in Power BI Desktop and Power BI service:
Refer to:
https://docs.microsoft.com/en-us/power-bi/enterprise/service-admin-rls
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @JonathanDavey1 ,
I have created a data sample and include the actual domain for "C".
Please try to create a measure, and apply it to visual-filter pane, set as "is 1":
Domain measure =
var _pos=FIND("\", USERNAME())
var _domain=LEFT(USERNAME(),_pos-1)
return IF(CONTAINSSTRING(MAX('Table'[Include domains]),_domain),1,0)
Output:
Best Regards,
Eyelyn Qin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
Thank you really appreciate your help! I managed to enable the Domain Measure in the BI-Desktop and it worked in principle (USERNAME doesnt return domain only LOCAL account), so I published to BI-Online, now the filtered visual throws an error.
Yours appreciatively
Jonathan
HI @JonathanDavey1 ,
Can you kindly add more details to your question like screenshots on what is the issue and what is expected?
https://community.powerbi.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
Hi, let me try again.
I would like to Filter my Table using the Users Logged in Domain.
Using "Measure = USERNAME" I am able to 'get' the User's name & domain.
Then I want to FILTER a Table using the Filters Contains Function.
The Table includes a Column containing the DOMAINs
Many Thanks
Jonathan
User | Count |
---|---|
78 | |
74 | |
43 | |
32 | |
28 |
User | Count |
---|---|
104 | |
93 | |
52 | |
50 | |
46 |