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

pie chart, sort using current users

Hi im trying to display a pie chart, short statistic.

I want to display it current to the user that is using the form.

 

If "User1" is opening the form he should see a pie chart based on his name only.

I have tried setting a variable on start and re-use that in a filter but the only way i succed is when i hardcode the name for it to filter from.

 

Test code below

Table(
      {
         Col: "Open", Value: Sum(ForAll(Filter(FlowTest, 'Case Category'.Value = "Choice 1"), 1), Value)
      },
      {
         Col: "Rejected", Value: Sum(ForAll(Filter(FlowTest, 'Case Category'.Value = "Choice 2"), 1), Value)
      },
      {
        Col: "Closed", Value: Sum(ForAll(Filter(FlowTest, What should i put here to make it work  && 'Case Category'.Value = "Choice 3"), 1), Value)
      }
)

I have tried using my variable

varUserEmail

 

I have tried using User().FullName and so on.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: pie chart, sort using current users

Hi @JimmyWork ,

Is the Assigned column a Person type column in your FlowTest SP list?

 

I have made a test on my side, please take a try with the following workaround:

Set the OnStart property of the App control to following formula:

Set(CurrentUser, User().FullName)

Set the Items property of the Pie Chart control to following:

Table(
      {
         Col: "Open", Value: Sum(ForAll(Filter(FlowTest, 'Case Category'.Value = "Choice 1", Assigned.DisplayName = CurrentUser), 1), Value)
      },
      {
         Col: "Rejected", Value: Sum(ForAll(Filter(FlowTest, 'Case Category'.Value = "Choice 2", Assigned.DisplayName = CurrentUser), 1), Value)
      },
      {
        Col: "Closed", Value: Sum(ForAll(Filter(FlowTest, 'Case Category'.Value = "Choice 3", Assigned.DisplayName = CurrentUser), 1), Value)
      }
)

Note: I assume that the Assigned is a Person type column in your FlowTest SP list data source.

Please re-load your app (fire the OnStart property of App), then check if the issue is solved.

 

Please take a try with above solution, check if the issue is sooved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

7 REPLIES 7
Dual Super User
Dual Super User

Re: pie chart, sort using current users

Hi @JimmyWork 

 

Assuming this is a SharePoint llist data source and lets say you want to only show results for the logged in user Created data

 

Table(
{
Col: "Open", Value: Sum(ForAll(Filter(FlowTest, 'Case Category'.Value = "Choice 1" && 'Created By'.Email=User().Email), 1), Value)
},
{
Col: "Rejected", Value: Sum(ForAll(Filter(FlowTest, 'Case Category'.Value = "Choice 2" && 'Created By'.Email=User().Email), 1), Value)
},
{
Col: "Closed", Value: Sum(ForAll(Filter(FlowTest, What should i put here to make it work && 'Case Category'.Value = "Choice 3" && 'Created By'.Email=User().Email), 1), Value)
}
)

 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

JimmyWork
Level 8

Re: pie chart, sort using current users

@RezaDorrani

Thank you but i cannot use created by because the user i want to display it to is not the one that creates it.

The user creates the item
IT closes the case or assignes to it.
I do have a column named Assigned so i should be able to use that instead of created by.

I will try in the morning and report back.
Thank you for taking time and answering
Dual Super User
Dual Super User

Re: pie chart, sort using current users

Hi @JimmyWork 

 

Yes use any person or group type field you have in place of created by

give it a shot and let me know 

good luck !!!

JimmyWork
Level 8

Re: pie chart, sort using current users

@RezaDorrani The solution you provided does not work.

It will not return the correct data and you get a delegation warning.

 

Using email does not work but DisplayName works but im gettting a delegation warning.

 

Col: "Closed", Value: CountRows(Filter(FlowTest, Test1.DisplayName = User().FullName && 'Case Category'.Value = "Choice 3"))
Dual Super User
Dual Super User

Re: pie chart, sort using current users

Hi @JimmyWork 

 

Test1.DisplayName = User().FullName

Firstly create a label and set  User().FullName to it

 

Next create a gallery with FlowTest as datasource

add a label to gallery and set its text property to ThisItem.Test1.DisplayName

 

check and see if the label and the gallery values match

 

 

Community Support Team
Community Support Team

Re: pie chart, sort using current users

Hi @JimmyWork ,

Is the Assigned column a Person type column in your FlowTest SP list?

 

I have made a test on my side, please take a try with the following workaround:

Set the OnStart property of the App control to following formula:

Set(CurrentUser, User().FullName)

Set the Items property of the Pie Chart control to following:

Table(
      {
         Col: "Open", Value: Sum(ForAll(Filter(FlowTest, 'Case Category'.Value = "Choice 1", Assigned.DisplayName = CurrentUser), 1), Value)
      },
      {
         Col: "Rejected", Value: Sum(ForAll(Filter(FlowTest, 'Case Category'.Value = "Choice 2", Assigned.DisplayName = CurrentUser), 1), Value)
      },
      {
        Col: "Closed", Value: Sum(ForAll(Filter(FlowTest, 'Case Category'.Value = "Choice 3", Assigned.DisplayName = CurrentUser), 1), Value)
      }
)

Note: I assume that the Assigned is a Person type column in your FlowTest SP list data source.

Please re-load your app (fire the OnStart property of App), then check if the issue is solved.

 

Please take a try with above solution, check if the issue is sooved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

JimmyWork
Level 8

Re: pie chart, sort using current users

@v-xida-msft  Thank you this works flawless Heart

Helpful resources

Announcements
thirdimage

Power Apps 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

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

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