Default Starting View Formula

Hi all.
Would really appreciate someone taking a look to see where I am butchering this expression to determine a default starting view.

I have 3 outcomes,

  1. A user is NOT in Users[Useremail] -> default to Register
  2. Registered users with certain userviews rights -> default to Portfolio
  3. Registered users with certain userviews rights -> default to Portfolio - All Status

The error is:
Condition OR(IN(โ€œObligation Team POCโ€,CurrentUserRights[UserViewsSelection]), IN(โ€œNLO Working Groupโ€,CurrentUserRights[UserViewsSelection]), IN(โ€œAccountable Executive Business Ownerโ€,CurrentUserRights[UserViewsSelection]), โ€œPortfolioโ€) has an invalid structure: subexpressions must be Yes/No conditions

Thank you.

IF
(NOT(IN(USEREMAIL(),Users[Useremail])),Register,

IF(OR(
IN("Obligation Team POC",CurrentUserRights[UserViewsSelection]),
IN("NLO Working Group", CurrentUserRights[UserViewsSelection]),
IN("Accountable Executive Business Owner", CurrentUserRights[UserViewsSelection]), Portfolio)),

IF(OR(
IN("NLO PMO", CurrentUserRights[UserViewsSelection]),
IN("Both NLO PMO and NLO Working Group", CurrentUserRights[UserViewsSelection]),Portfolio - All Status)
))
Solved Solved
1 4 405
1 ACCEPTED SOLUTION

I think your parentheses are in the wrong places. Try the following. And in a moment I will update this post with a shorter expression to accomplish the same thing.

IF
(NOT(IN(USEREMAIL(),Users[Useremail])),"Register",

IF(OR(
IN("Obligation Team POC",CurrentUserRights[UserViewsSelection]),
IN("NLO Working Group", CurrentUserRights[UserViewsSelection]),
IN("Accountable Executive Business Owner", CurrentUserRights[UserViewsSelection])), "Portfolio",

IF(OR(
IN("NLO PMO", CurrentUserRights[UserViewsSelection]),
IN("Both NLO PMO and NLO Working Group", CurrentUserRights[UserViewsSelection])),"Portfolio - All Status")
))



Ok, maybe not way shorter yet, but using IFS instead of nested IF minimizes the nesting parentheses complications. Iโ€™m guessing you have a slice โ€œCurrentUserRightsโ€ that only shows the โ€œUsersโ€ record for the current user? And is there only ever 1 โ€œUsersโ€ record per user? Is the [UserViewsSelection] column a single selection, or an EnumList?

IFS(

  NOT( IN( USEREMAIL() , Users[Useremail] ) ) , 
  "Register" ,

  OR(
    IN("Obligation Team POC",CurrentUserRights[UserViewsSelection]),
    IN("NLO Working Group", CurrentUserRights[UserViewsSelection]),
    IN("Accountable Executive Business Owner", CurrentUserRights[UserViewsSelection])
    ) ,
  "Portfolio" ,

  OR(
    IN("NLO PMO", CurrentUserRights[UserViewsSelection]),
    IN("Both NLO PMO and NLO Working Group", CurrentUserRights[UserViewsSelection])
    ) ,
  "Portfolio - All Status"

)

View solution in original post

4 REPLIES 4

I think your parentheses are in the wrong places. Try the following. And in a moment I will update this post with a shorter expression to accomplish the same thing.

IF
(NOT(IN(USEREMAIL(),Users[Useremail])),"Register",

IF(OR(
IN("Obligation Team POC",CurrentUserRights[UserViewsSelection]),
IN("NLO Working Group", CurrentUserRights[UserViewsSelection]),
IN("Accountable Executive Business Owner", CurrentUserRights[UserViewsSelection])), "Portfolio",

IF(OR(
IN("NLO PMO", CurrentUserRights[UserViewsSelection]),
IN("Both NLO PMO and NLO Working Group", CurrentUserRights[UserViewsSelection])),"Portfolio - All Status")
))



Ok, maybe not way shorter yet, but using IFS instead of nested IF minimizes the nesting parentheses complications. Iโ€™m guessing you have a slice โ€œCurrentUserRightsโ€ that only shows the โ€œUsersโ€ record for the current user? And is there only ever 1 โ€œUsersโ€ record per user? Is the [UserViewsSelection] column a single selection, or an EnumList?

IFS(

  NOT( IN( USEREMAIL() , Users[Useremail] ) ) , 
  "Register" ,

  OR(
    IN("Obligation Team POC",CurrentUserRights[UserViewsSelection]),
    IN("NLO Working Group", CurrentUserRights[UserViewsSelection]),
    IN("Accountable Executive Business Owner", CurrentUserRights[UserViewsSelection])
    ) ,
  "Portfolio" ,

  OR(
    IN("NLO PMO", CurrentUserRights[UserViewsSelection]),
    IN("Both NLO PMO and NLO Working Group", CurrentUserRights[UserViewsSelection])
    ) ,
  "Portfolio - All Status"

)

Spot on, thank you.
Yes - there is only ever 1 users record per user with [UserViewsSelection] a single selection.

You should be able to reduce the expression to this then:

IFS(

  NOT( IN( USEREMAIL() , Users[Useremail] ) ) , 
  "Register" ,

  IN( 
    ANY( CurrentUserRights[UserViewsSelection] ) , 
    LIST( "Obligation Team POC", "NLO Working Group" , "Accountable Executive Business Owner" )
    ) ,
  "Portfolio" ,

  IN(
    ANY( CurrentUserRights[UserViewsSelection] ) , 
    LIST( "NLO PMO" , "Both NLO PMO and NLO Working Group" )
    ) ,
  "Portfolio - All Status"

)

Thank you, @Marc_Dillon!

Top Labels in this Space