0

I am trying to make several roles in PBI but if I select more than variable, my rule won't work. Example

[Company Profile Country] = "US" && [Company Profile Country] = "CA" 

I don't get any error messages, but nothing shows up when I 'view as'. Any thoughts? If I do just US or just CA then it works fine.

Henry Ecker
  • 34,399
  • 18
  • 41
  • 57
courty340
  • 101
  • 3
  • 16
  • Yes, that's a logical error you're making. How can something be in US and CA at the same time? – W.B. Feb 17 '21 at 02:57
  • @W.B Thanks, I was just using that as an example. OR is not working for row level security. Using OR doesn't work in a powerbi DAX statement, and if I separate the two by commas it does not give me results. – courty340 Feb 17 '21 at 15:00
  • I don't mean OR literally, but `||` instead of `&&` – W.B. Feb 17 '21 at 15:16
  • And OR does work, but as a function. See https://learn.microsoft.com/en-us/dax/or-function-dax – W.B. Feb 17 '21 at 15:43
  • Thank you. That is working for me now but still not fully solving what I am trying to do here. [Company Profile Country] = "US" && [Company Division] = "ABC" I now need to filter based 2 different things, so I am trying to create a role where the user can see only company ABC in the US. This DAX code above doesn't give any error message but also isn't working. – courty340 Feb 17 '21 at 20:03
  • Well, you're not giving an awful lot of detail here - it's impossible to tell anything, unless you provide sample data that you are working on. – W.B. Feb 17 '21 at 21:37

1 Answers1

0

You are using wrong logical operator. You want to display data if it belongs to US OR if it belongs to CA. So the operator should be || instead of &&.

W.B.
  • 5,445
  • 19
  • 29