Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
chat_peters
Helper III
Helper III

Explain why dax lookupvalue does not work with RLS

Please help

Here's the link to my power bi file 

Data model:

chat_peters_1-1707241982852.png

 

 

 

 

 

 

 

 

 

 

 

 

I have a similar RLS measure created. Except it throws an error everytime. Here's my model and here's the dax expression I wrote. 

'Region'[Specialty ID] = LOOKUPVALUE(
'Worker'[Specialty ID],
'Worker'[Worker ID], CUSTOMDATA(),
'Worker'[Specialty ID], 'Region'[Specialty ID])

 

I get an error saying LOOKUPVALUE doesn't support comparing integers with string. So I altered the measure like this 

'Region'[Specialty ID] = LOOKUPVALUE(
'Worker'[Specialty ID],
'Worker'[Worker ID], VALUE(CUSTOMDATA(),"")
'Worker'[Specialty ID], 'Region'[Specialty ID])


Then I can't pick 'Region'[Specialty ID], because it's can't pick one value. I don't understand that part because Region[Specialty ID] has unique values. Then I had to do the following

 

 

'Region'[Specialty ID] = LOOKUPVALUE(
'Worker'[Specialty ID],
'Worker'[Worker ID], VALUE(CUSTOMDATA(),""),

'Worker'[Specialty ID], MINX('Region',[Specialty ID])

 

I understand wrapping VALUE around CUSTOMDATA() function. All the IDs are whole number type. But I don't understand why I was not allowed to pick Region[Specialty ID] as a comparison given the fact that all Specialty IDs in Region are unique.

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi, @chat_peters 

I'm happy to answer your questions. I have tested your DAX formula; The test results are as follows:

1.png

2.png

3.png

The main reason for this error is that CUMSTOMDATA () returns a string type data or returns BLANK (). Because worker '[worker ID] is Number, it is reported in Power BI. You can avoid errors by changing the type of worker '[worker id] to Text:

4.png

5.png

If this can help you, it's great.

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi, @chat_peters 

I'm happy to answer your questions. I have tested your DAX formula; The test results are as follows:

1.png

2.png

3.png

The main reason for this error is that CUMSTOMDATA () returns a string type data or returns BLANK (). Because worker '[worker ID] is Number, it is reported in Power BI. You can avoid errors by changing the type of worker '[worker id] to Text:

4.png

5.png

If this can help you, it's great.

 

 

 

 

How to Get Your Question Answered Quickly

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Jianpeng Li

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous  The example I gave you is in an import model and it works perfectly well with wrapping Value() around Region[Specialty ID] as you have shown above and I tested it with one user ID. However, my real power bi project is on directquery mode. So lookup is not allowed. How can I adjust this measure

'Region'[Specialty ID] = LOOKUPVALUE(
'Worker'[Specialty ID],
'Worker'[Worker ID], VALUE(CUSTOMDATA(),""),

'Worker'[Specialty ID], VALUE('Region'[Specialty ID]))

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.