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

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
Super User
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
Super User
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
KimberlyM
Level: Powered On

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
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 330 members 2,999 guests
Please welcome our newest community members: