Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

single value was expected?

I get the below error:

 

 

 

My code in the Role is:

 

[Key_Customer] IN

SELECTCOLUMNS(

    FILTER(

        'Customer',

        LOOKUPVALUE(

'Customer'[Key_Customer],

'Customer'[Lead_EmpNo],

LOOKUPVALUE(Employee[EmpNo],Employee[NTUserName], USERNAME())

        )

    )

    ,"Cust" ,'Customer'[Key_Customer])

 

 

For any given USERNAME() ,  of course there is only one [NTUserName].

 

For any given EmpNo, there are many  Lead_EmpNo (this is the whole point of the RLS)

 

3 Replies

  • Anonymous , filter should have true and false , not very clear if this will return true false

     

    try like

     

    [Key_Customer] IN

    SELECTCOLUMNS(

    FILTER(

    'Customer',

    LOOKUPVALUE(

    'Customer'[Key_Customer],

    'Customer'[Lead_EmpNo],

    LOOKUPVALUE(max(Employee[EmpNo]),Employee[NTUserName], USERNAME())

    )

    )

    ,"Cust" ,'Customer'[Key_Customer])

    • Anonymous's avatar
      Anonymous
      Not applicable

      A MAX cannot be added there...

       

  • v-henryk-mstf's avatar
    v-henryk-mstf
    Icon for Community Support rankCommunity Support

    Hi Anonymous ,

     

    That error usually arises by using a function which expects a scalar value but yet the computation of the code returns a tableor more than 1 value.

     

    You probably just want to do something like the similar posts as below: Solved: A table of multiple values was supplied where a si... - Microsoft Power BI Community


    If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.

    Best Regards,
    Henry

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