I am trying to filter a gallery based on the current user logged in for a specific SharePoint list.
I have this code sorta working
SortByColumns(
Filter(
'POWER SYSTEM ELECTRICIAN Work Hours',
'Apprentice Name' = Upper(varCurrentUserFullName), Month="July"
),
"Date",
Descending
)
I could have multiple entries for each month and year that need to be summed and filter, sort based on the button clicked on the previous gallery to filter the data
Both of the records are mine but I want them rolled up and summed per category. I am stuck on how to add the filter from one gallery to another.
My SharePoint list I have the Apprentice Name, Year, and Month
Solved! Go to Solution.
Well it took me a few days but I have it working here is my solution
If(
IsBlank(vFilter & wQtr & vYear),
Filter(
'POWER SYSTEM ELECTRICIAN Work Hours',
ApprenticeName.Email = CurrentUserEmail
),
If(
!IsBlank(vFilter),
Filter(
'POWER SYSTEM ELECTRICIAN Work Hours',
ApprenticeName.Email = CurrentUserEmail && (Month = vFilter)
),
If(
!IsBlank(wQtr),
Filter(
'POWER SYSTEM ELECTRICIAN Work Hours',
ApprenticeName.Email = CurrentUserEmail && (Quarter = wQtr)
)
)
)
)
Ok so since no one is helping me here is what I have so far.
I got this code to sort of work I need to filter the gallery based on the user signed in to the app.
SortByColumns(
If(
IsBlank(vFilter),
Filter(
'POWER SYSTEM ELECTRICIAN Work Hours',
'Apprentice Name' = Upper(varCurrentUserFullName)
),
Filter(
'POWER SYSTEM ELECTRICIAN Work Hours',
Month = vFilter
)
),
"Date",
Descending
)
However, it acts like it is doing it but it really isn't. As you can see from the image below I am logged in user, but it is displaying other user information.
I have this on the month filter buttons but it resets the filter of the gallery back to all users instead of just the current user logged in.
UpdateContext({vFilter:"MAY"})
I still haven't figured out how to make the Quarter buttons work yet. I have this code that @WarrenBelz provided, but I also need to be able to filter by the month as well.
With(
{
wQtr:
Text(
RoundUp(
Month(Now()) / 3,
0
)
)
},
SortByColumns(
Filter(
'POWER SYSTEM ELECTRICIAN Work Hours',
StartsWith(
'Apprentice Name',
varCurrentUserFullName
) &&
Quarter = wQtr
),
"Date",
Descending
)
)
So in short I need to have the gallery filtered by the user who is logged in, then filter that same data by month and quarter and possibly by year!
I would really appreciate any help!
Well it took me a few days but I have it working here is my solution
If(
IsBlank(vFilter & wQtr & vYear),
Filter(
'POWER SYSTEM ELECTRICIAN Work Hours',
ApprenticeName.Email = CurrentUserEmail
),
If(
!IsBlank(vFilter),
Filter(
'POWER SYSTEM ELECTRICIAN Work Hours',
ApprenticeName.Email = CurrentUserEmail && (Month = vFilter)
),
If(
!IsBlank(wQtr),
Filter(
'POWER SYSTEM ELECTRICIAN Work Hours',
ApprenticeName.Email = CurrentUserEmail && (Quarter = wQtr)
)
)
)
)
User | Count |
---|---|
258 | |
111 | |
95 | |
48 | |
41 |