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

Filter gallery using piechart

Hai ,

 

I need to filter my data in gallery by taping on Pie chart. if i tap on A items i want category: A  from gallery to be displayed and same for B items and C items.

 

Thnak you!

 

abc analysis.PNG

 

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Filter gallery using piechart

You can reference the Selected property of your pie chart in a Filter expression on the Items property of your gallery. For example, if this is your currently selected expression:

SortByColumns(
    Search(
        Items,
        TextSearchBox1.Text,
        "Name"),
    "Name",
    If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

You can filter the items before searching those:

SortByColumns(
    Search(
        Filter(Items, IsBlank(PieChart1.Selected.Category) Or Category = PieChart1.Selected.Category),
        TextSearchBox1.Text,
        "Name"),
    "Name",
    If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

The attached app shows this expression being used. To open it, save it locally, then go to https://create.powerapps.com, select Open, Browse, then select the file that you previously saved.

Hope this helps!

Community Support Team
Community Support Team

Re: Filter gallery using piechart

Hi @PremSagar ,

Could you please share a bit more about the Category column in your data source? Is it a Text column or a Choice type column (your data source is a SP List)?

Do you want to filter your Gallery Items based on the selected Pie in your Pie Chart control?

 

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

1. If the Category column is a Text type column in your data source:

 Set the Items property of the Gallery to following:

Filter(
         'YourDataSource',
         If(
            IsBlank(PieChart1.Selected.CategoryColumn),         /* <-- If not select a pie in your Pie Chart, display all Gategory reocrds in your Gallery */
            true,
            Category = PieChart1.Selected.CategoryColumn
         )
)

Note: The CategoryColumn represents the column in the data source your Pie Chart control connects to, which used to store the "A Items", "B Items", "C Items". The Category represents the column in your data source your Gallery connects to.

 

2. If the Category column is a Choice column in your data source (a SP List):

 Set the Items property of the Gallery to following:

Filter(
         'YourDataSource',
         If(
            IsBlank(PieChart1.Selected.CategoryColumn),
            true,
            Category.Value = PieChart1.Selected.CategoryColumn
         )
)

More details about the Filter function, please check the following article:

Filter function

 

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

 

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.
2 REPLIES 2
PowerApps Staff CarlosFigueira
PowerApps Staff

Re: Filter gallery using piechart

You can reference the Selected property of your pie chart in a Filter expression on the Items property of your gallery. For example, if this is your currently selected expression:

SortByColumns(
    Search(
        Items,
        TextSearchBox1.Text,
        "Name"),
    "Name",
    If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

You can filter the items before searching those:

SortByColumns(
    Search(
        Filter(Items, IsBlank(PieChart1.Selected.Category) Or Category = PieChart1.Selected.Category),
        TextSearchBox1.Text,
        "Name"),
    "Name",
    If(SortDescending1, SortOrder.Descending, SortOrder.Ascending))

The attached app shows this expression being used. To open it, save it locally, then go to https://create.powerapps.com, select Open, Browse, then select the file that you previously saved.

Hope this helps!

Community Support Team
Community Support Team

Re: Filter gallery using piechart

Hi @PremSagar ,

Could you please share a bit more about the Category column in your data source? Is it a Text column or a Choice type column (your data source is a SP List)?

Do you want to filter your Gallery Items based on the selected Pie in your Pie Chart control?

 

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

1. If the Category column is a Text type column in your data source:

 Set the Items property of the Gallery to following:

Filter(
         'YourDataSource',
         If(
            IsBlank(PieChart1.Selected.CategoryColumn),         /* <-- If not select a pie in your Pie Chart, display all Gategory reocrds in your Gallery */
            true,
            Category = PieChart1.Selected.CategoryColumn
         )
)

Note: The CategoryColumn represents the column in the data source your Pie Chart control connects to, which used to store the "A Items", "B Items", "C Items". The Category represents the column in your data source your Gallery connects to.

 

2. If the Category column is a Choice column in your data source (a SP List):

 Set the Items property of the Gallery to following:

Filter(
         'YourDataSource',
         If(
            IsBlank(PieChart1.Selected.CategoryColumn),
            true,
            Category.Value = PieChart1.Selected.CategoryColumn
         )
)

More details about the Filter function, please check the following article:

Filter function

 

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

 

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.