cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
KimberlyM
Level 8

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

KimberlyM
Level 8

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
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

Top Kudoed Authors (Last 30 Days)
Users online (5,302)