cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper IV
Helper IV

Filtering a chart to display like gallery based on user logged in

I have made it so my gallery filters with this code: 

If(!IsEmpty(Filter(Admin_LeadData,FullName = varUser)), Lead_Data, 
Filter(Lead_Data, AssignedTo.Value = varUser || LeadMember1.Value = varUser || LeadMember2.Value = varUser || LeadMember3.Value = varUser || LeadMember4.Value = varUser))


I have a chart that pulls data from a collection that currently pulls data in from a statement on my dashboard screen:

ClearCollect(
   colDash_StatusTrack, 
   {
      Status: "Not Started",
      Count: CountIf(Lead_Data, Status.Value = "Not Started")
   },
   {
   Status: "In Progress",
   Count: CountIf(Lead_Data, Status.Value = "In Progress")
   },
   {
   Status: "Dead Deal",
   Count: CountIf(Lead_Data, Status.Value = "Dead Deal")
   },
   {
   Status: "Completed Deal",
   Count: CountIf(Lead_Data, Status.Value = "Completed Deal")
   }
);

I now would like this chart to display with the same filters as the gallery but I am not sure where to start with this. Tips/tricks/best practices, should this be as hard as I am feeling it is?

I have gotten this far but it does not filter the results for just the user like I think that it would - I see the count for all the entries into my SharePoint list.

ClearCollect(colDash_StatusTrack,{Agent: LookUp(Agents, FullName = varUser), Status: "Not Started", Count: CountIf(Lead_Data, Status.Value = "Not Started")} );
Collect(colDash_StatusTrack,{Agent: LookUp(Agents, FullName = varUser), Status: "In Progress", Count: CountIf(Lead_Data, Status.Value = "In Progress")} );
Collect(colDash_StatusTrack,{Agent: LookUp(Agents, FullName = varUser), Status: "Dead Deal", Count: CountIf(Lead_Data, Status.Value = "Dead Deal")} );
Collect(colDash_StatusTrack,{Agent: LookUp(Agents, FullName = varUser), Status: "Completed Deal", Count: CountIf(Lead_Data, Status.Value = "Completed Deal")} );

This will not produce my chart at all:

If(!IsEmpty(Filter(Admin_LeadData,FullName = varUser)), 
  ClearCollect(colDash_StatusTrack,{Status: "Not Started", Count: CountIf(Lead_Data, Status.Value = "Not Started")} );
  Collect(colDash_StatusTrack,{Status: "In Progress", Count: CountIf(Lead_Data, Status.Value = "In Progress")} );
  Collect(colDash_StatusTrack,{Status: "Dead Deal", Count: CountIf(Lead_Data, Status.Value = "Dead Deal")} );
  Collect(colDash_StatusTrack,{Status: "Completed Deal", Count: CountIf(Lead_Data, Status.Value = "Completed Deal")} );, 
Filter(Lead_Data, AssignedTo.Value = varUser || LeadMember1.Value = varUser || LeadMember2.Value = varUser || LeadMember3.Value = varUser || LeadMember4.Value = varUser))  
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Dual Super User
Dual Super User

Re: Filtering a chart to display like gallery based on user logged in

Hi @KimberlyM 

 

For the chart to work properly the columns in the both the expressions(either true condition or false condition) should be same. Based on my understanding, you can update the expression as:
If(!IsEmpty(Filter(Admin_LeadData,FullName = varUser)), 
  ClearCollect(colDash_StatusTrack,{Status: "Not Started", Count: CountIf(Lead_Data, Status.Value = "Not Started")} );
  Collect(colDash_StatusTrack,{Status: "In Progress", Count: CountIf(Lead_Data, Status.Value = "In Progress")} );
  Collect(colDash_StatusTrack,{Status: "Dead Deal", Count: CountIf(Lead_Data, Status.Value = "Dead Deal")} );
  Collect(colDash_StatusTrack,{Status: "Completed Deal", Count: CountIf(Lead_Data, Status.Value = "Completed Deal")} ),
  ClearCollect(colDash_StatusTrack,{Status: "Not Started", Count: CountIf(Lead_Data, Status.Value = "Not Started" && Or(AssignedTo.Value = varUser,LeadMember1.Value = varUser,LeadMember2.Value = varUser,LeadMember3.Value = varUser))} );
  Collect(colDash_StatusTrack,{Status: "In Progress", Count: CountIf(Lead_Data, Status.Value = "In Progress" && Or(AssignedTo.Value = varUser,LeadMember1.Value = varUser,LeadMember2.Value = varUser,LeadMember3.Value = varUser))} );
  Collect(colDash_StatusTrack,{Status: "Dead Deal", Count: CountIf(Lead_Data, Status.Value = "Dead Deal" && Or(AssignedTo.Value = varUser,LeadMember1.Value = varUser,LeadMember2.Value = varUser,LeadMember3.Value = varUser))} );
  Collect(colDash_StatusTrack,{Status: "Completed Deal", Count: CountIf(Lead_Data, Status.Value = "Completed Deal" && Or(AssignedTo.Value = varUser,LeadMember1.Value = varUser,LeadMember2.Value = varUser,LeadMember3.Value = varUser))} ))
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

2 REPLIES 2
Highlighted
Dual Super User
Dual Super User

Re: Filtering a chart to display like gallery based on user logged in

Hi @KimberlyM 

 

For the chart to work properly the columns in the both the expressions(either true condition or false condition) should be same. Based on my understanding, you can update the expression as:
If(!IsEmpty(Filter(Admin_LeadData,FullName = varUser)), 
  ClearCollect(colDash_StatusTrack,{Status: "Not Started", Count: CountIf(Lead_Data, Status.Value = "Not Started")} );
  Collect(colDash_StatusTrack,{Status: "In Progress", Count: CountIf(Lead_Data, Status.Value = "In Progress")} );
  Collect(colDash_StatusTrack,{Status: "Dead Deal", Count: CountIf(Lead_Data, Status.Value = "Dead Deal")} );
  Collect(colDash_StatusTrack,{Status: "Completed Deal", Count: CountIf(Lead_Data, Status.Value = "Completed Deal")} ),
  ClearCollect(colDash_StatusTrack,{Status: "Not Started", Count: CountIf(Lead_Data, Status.Value = "Not Started" && Or(AssignedTo.Value = varUser,LeadMember1.Value = varUser,LeadMember2.Value = varUser,LeadMember3.Value = varUser))} );
  Collect(colDash_StatusTrack,{Status: "In Progress", Count: CountIf(Lead_Data, Status.Value = "In Progress" && Or(AssignedTo.Value = varUser,LeadMember1.Value = varUser,LeadMember2.Value = varUser,LeadMember3.Value = varUser))} );
  Collect(colDash_StatusTrack,{Status: "Dead Deal", Count: CountIf(Lead_Data, Status.Value = "Dead Deal" && Or(AssignedTo.Value = varUser,LeadMember1.Value = varUser,LeadMember2.Value = varUser,LeadMember3.Value = varUser))} );
  Collect(colDash_StatusTrack,{Status: "Completed Deal", Count: CountIf(Lead_Data, Status.Value = "Completed Deal" && Or(AssignedTo.Value = varUser,LeadMember1.Value = varUser,LeadMember2.Value = varUser,LeadMember3.Value = varUser))} ))
Hope this Helps!

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

View solution in original post

Highlighted
Helper IV
Helper IV

Re: Filtering a chart to display like gallery based on user logged in

@yashag2255 Thank you! This gets me so much further. I am happy to report that I am very happy with how this is now working in my app.

Helpful resources

Announcements
secondImage

Demo-Extravaganza 2020

Check out these cool Power Apps & vote on your favorite!

secondImage

Robotic Process Automation

Let's talk about the solution provided by Microsoft for Robotic Process Automation (RPA)

secondImage

Community Highlights

Check out whats happening in Power Apps

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

Top Solution Authors
Top Kudoed Authors
Users online (6,228)