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 September 15. Request your voucher.
Guys, I have a reasoning problem here,
I created a dashboard in Power BI with some sales information. In this report I applied RLS security so that users only see information about the customers they serve, that is, they cannot see sales from other sellers. I need to create a dynamic title that brings the seller's name respecting the RLS applied, that is, if the seller's name is "João da Silva" the title needs to be "João da Silva", as the filter applied to the RLS is "João da Silva".
I have a customer table to which I applied RLS. Each customer is served by a salesperson (as in a customer portfolio). There is an internal and external portfolio where the internal portfolio are salespeople who work within the company and the external portfolio are salespeople who work outside the company. Basically the table is: Customer | Internal Wallet | External Wallet
I need the salesperson, when entering Power BI, to see his name in the deashboard title, as his name is in the RLS of the customers table. If it is an internal seller, the name of the internal seller must appear, if it is an external seller, then the name of the external seller must appear.
I tried to use a SELECTEDVALUE in the table column where the seller's name is, but it didn't work, as the SELECTEDVALUE does not work in RLS but in data segmentation. The USERNAME() function does not help, as it does not provide the correct name of the seller.
The DAX measure below works, however it is mandatory to apply a filter in the data segmentation and, as I already said, the filter will be in the RLS, I need to make the reasoning in the measure below work without it being mandatory to filter in the data segmentation.
DAX...
Selected Portfolio =
// Brings the name of the wallet that was filtered in the segmenter
IF(
AND(
NOT ISFILTERED('Customer- 8040'[External]), NOT ISFILTERED('dClientes - 8040'[Internal])),
"No wallet selected",
IF(
AND(
NOT ISFILTERED('Customer- 8040'[External]), NOT ISFILTERED('dCustumer - 8040'[Internal])),
"No wallet selected",
IF(
AND(
ISFILTERED('dCustumer - 8040'[External]),ISFILTERED('dCustumer - 8040'[Internal])),
"Multiple selected wallets",
IF(
ISFILTERED('dCustumer - 8040'[External]),SELECTEDVALUE('dCustumer - 8040'[External]),
IF(
ISFILTERED('dCustumer - 8040'[Internal]),SELECTEDVALUE('dCustumer - 8040'[Internal])
)
)
)
)
Solved! Go to Solution.
Hi, @Rai_BI
You can try the following methods.
Dynamic Salesperson Title =
VAR CurrentUser = USERNAME()
VAR SalespersonName = LOOKUPVALUE(UsernameTable[SalespersonName], UsernameTable[Username], CurrentUser)
RETURN
IF(
ISBLANK(SalespersonName),
"No salesperson found",
SalespersonName
)
If this does not solve your problem, please provide more details.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Rai_BI
You can try the following methods.
Dynamic Salesperson Title =
VAR CurrentUser = USERNAME()
VAR SalespersonName = LOOKUPVALUE(UsernameTable[SalespersonName], UsernameTable[Username], CurrentUser)
RETURN
IF(
ISBLANK(SalespersonName),
"No salesperson found",
SalespersonName
)
If this does not solve your problem, please provide more details.
Best Regards,
Community Support Team _Charlotte
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Thank you!
User | Count |
---|---|
15 | |
13 | |
9 | |
6 | |
6 |
User | Count |
---|---|
27 | |
18 | |
13 | |
9 | |
5 |