I want to populate a drop down depending on the user is Admin or not from two tables:
1) SALESMAN: Columns ID(GUID), NAME(Single Line of Text) , LOCATION(Single Line of Text -showing all the locations Salesman Assigned to) and UserRole(Single Line of Text)
2) PERIOD: Columns ID(GUID), YEAR(Single Line of Text) , LOCATION(Single Line of Text-- Values are if admin then all the Locations from Period Table else as in the second argument,
like:
if (UserRole="Admin", Filter(Period, Year=Year dropdown) for the Location field,
with({var_UserAssignedLocations: showcolumns(filter(Salesman, name=user().displayname),Location)}, filter(Period, year = YearDropDown.selected.value, Location in var_UserAssginedLocations)))
(Thanks Akshansh-Sharma for the very useful solution in this community for the second option)
How to best accomplish it, as some or the other error is being thrown for the if statement!