Show_if Column Expression Returns True Yet is Hidden

On a columnโ€™s show_if constraint, I have the following expression:

ISNOTBLANK(INTERSECT(
LIST("Supervisor","Manager"),SPLIT(Me[Position], ", ")
))

โ€œMe[Position]โ€ is a slice of a Users table that returns only one row (the current user) and the column returned is an EnumList.
Intended behavior is to return TRUE (show column on form) if the current user has โ€œSupervisorโ€ and/or โ€œManagerโ€ in their Position column.

The Test Table Data returns TRUE but yet no field is displayed. Have this problem on multiple columns in multiple apps now, when I could have sworn it worked before (dont hold me to that, Iโ€™m still a noob).

Removing the expression or using a simpler true/false statement shows the column as intended (so its not a column order setting on a view at least).

This expression:

if(
ISNOTBLANK(INTERSECT(LIST(โ€œSupervisorโ€,โ€œManagerโ€),
SPLIT(Me[Position], ", "))),
TRUE,[User ID]=USEREMAIL()
)

works as intended when used as a security filter within the same app. I had no luck by similarly-wrapping the first expression in an If statement.

Suggestions?

0 9 597
9 REPLIES 9

May I ask why donโ€™t you use a LOOKUP expression provided you have userโ€™s email address in your Users table?

IN(
	{"Superviser" , "Manager"},
	LOOKUP(
		USEREMAIL()
		"Users",
		"Email",
		"Position"
	)
)

Thank you for your response. I tried this initially, and the problem I had was lookup was a list and so was the column returned. I didnt set it up exactly like that but will try just that and let you know.

My second thought on making a slice instead of a lookup was because this returned result would be done multiple times per app normal app usage. Not exactly sure yet how much little things like that matter in this platform.

Can you please elaborate?

Bahbus
New Member

Should be:
IN( ANY( Me[Position] ) , {"Supervisor" , "Manager"} )
and thatโ€™s it.
or @LeventKโ€™s solution but with the inputs swapped, because theyโ€™re backwards.

@Bahbus
My tests showed that both IN and CONTAINS does not work in this case. The only working expression was:

ISNOTBLANK(
	INTERSECT(
		SPLIT(
			LOOKUP(
				[_THISROW].[USER],
				"MyUsers",
				"EMAIL",
				"POSITION"
			),
			","
		),
		{"Supervisor" , "Manager"}
	)
)

Sure.
I found that I had the same Error described here:

Instead of adding a blank list to the list, SPLIT was suggested to me to use after I contacted support.

ISNOTBLANK(
INTERSECT(
SPLIT(
LOOKUP(
USEREMAIL(),
โ€œUSERSโ€,
โ€œIDโ€,
โ€œPOSITIONโ€
),
โ€œ,โ€
),
{โ€œSupervisorโ€ , โ€œManagerโ€}
)
)
Works as intended. Thank you. I am gonna try to see if there is a way to do this with a slice still, but only because I expect to use this expression in many areas in the app. Im assuming a reference to a slice 10 times is โ€˜lighterโ€™ than a lookup 10 times so please let me know if I am overthinking this.

The other expression mention indeed do not fully work as expected:

IN( ANY( Me[Position] ) , {โ€œSupervisorโ€ , โ€œManagerโ€} )

does not account for multiple values being in [Position].

IN( {โ€œSupervisorโ€ , โ€œManagerโ€}, ANY( Me[Position] ) )

requires [Position] to contain both โ€œSupervisorโ€ AND (not and/or) โ€œManagerโ€.

This is what I was looking for:

ISNOTBLANK(
INTERSECT(
SPLIT(
ANY(Me[Position]),
โ€œ,โ€
),
{โ€œSupervisorโ€ , โ€œManagerโ€}
)
)

I was so close. Thank you for the final piece.

DOES NOT WORK

ISNOTBLANK(
INTERSECT(
LIST(
โ€œSupervisorโ€,โ€œManagerโ€
),
SPLIT(
Me[Position],
", "
)
)
)

DOES WORK

ISNOTBLANK(
INTERSECT(
LIST(
โ€œSupervisorโ€,โ€œManagerโ€
),
SPLIT(
Me[Position],
โ€œ,โ€
)
)
)

The difference is the one space after the comma in the second SPLIT argument. Values in spreadsheet are separated by " , " (Supervisor , Manager , Installer , Courier).
Thanks again for the needed perspective.

Bahbus
New Member

Ah, I did not understand that a person could have multiple roles. I figured it was a hieratical setup.

Top Labels in this Space