cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Further advance filtering on Charts

Dear @PowerAddict 

 

Based on your and others wonderful support I made the following, 

 

  1. Collection to find sales by location
  2. Collection to summarize the sales by location
  3. Chart to show the summary sales by location 

Capture.PNG

 

I want the location chart to filter based on the Year selection in the dropdown. In the location summary the SalesYear column has under the group. I tried following way but did not work

 

If(Dropdown2_1.Selected.Value="All",SalesSumbyLocation,Filter(SalesSumbyLocation, Grouped.SalesYear = Text(Dropdown2_1.Selected.Value)))
 
It says under the = sign invalid argument type 
 
Annotation 2019-11-30 055714.jpg

 

Kindly help

 

Osmand

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Further advance filtering on Charts

Ok, right, now I see, this is because you have multiple rows in each Grouped.SalesYear, so it's a list of entries rather than one item, so we can't compare a box of Apples with an Apple (if that makes sense?)

 

Could you try these two different formulae? I'm not actually 100% sure these will work, as I think the issue is that it's not able to compare multiple sub-items to a singular parent item.

 

If(
   Dropdown2_1.Selected.Value="All",
      SalesSumbyLocation,
   Filter(SalesSumbyLocationDropdown2_1.Selected.Value in Text(Grouped.SalesYear.Value, "YYYY"))
)

 

If(
   Dropdown2_1.Selected.Value="All",
      SalesSumbyLocation,
   Filter(SalesSumbyLocation, Text(Grouped.SalesYear.Value, "YYYY") = Dropdown2_1.Selected.Value)
)

 

 

Another way of solving this would be to create a new collection, which has the parent (SalesBySumLocation) ID as a new column maybe called RowID, and the contents of Grouped.SalesYear, using AddColumns and ClearCollect, and then filtering That to then show only those items where the Year matches, then comparing your original to this filtered list where the ID's and RowID's match.




Don't forget to 'Mark as Solution' if a post answered your question and always 'Thumbs Up' the posts you like or helped you!

View solution in original post

20 REPLIES 20
Super User
Super User

Re: Further advance filtering on Charts

What happens when you try without the Text function?

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit Bhatia
https://thepoweraddict.com

Re: Further advance filtering on Charts

@PowerAddict  same error brother, invalid argument type 

Super User
Super User

Re: Further advance filtering on Charts

Ok. Two questions:

1. Show me your SalesSumByLocation collection by going to View->Collections

2. Show me the items property of Dropdown2_1

Thanks,
Hardit

Re: Further advance filtering on Charts

@PowerAddict 

 

There you go

 

1. 

Capture.PNGCapture1.PNG

 

2.  Item property set as 

["All","2019","2020"]
Super User
Super User

Re: Further advance filtering on Charts

Ok so the problem is that your year numbers are in decimal format. You need to first change them to numbers without decimals.

Try something like:

Left(Find(Grouped.SalesYear), ".") instead of Grouped.Sales in your filter expression.

Let me know if this helps.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit Bhatia
https://thepoweraddict.com

Re: Further advance filtering on Charts

Thank you @PowerAddict  I tried but did not work

 

If(Dropdown2_1.Selected.Value="All",SalesSumbyLocation,Filter(SalesSumbyLocation, Left(Find(Grouped.SalesYear),".") = Text(Dropdown2_1.Selected.Value)))
 
I think left function is not complete. Also I tried as below, 
 
If(Dropdown2_1.Selected.Value="All",SalesSumbyLocation,Filter(SalesSumbyLocation, Left(Find(Grouped.SalesYear),".",4) = Text(Dropdown2_1.Selected.Value)))
 
Did not work
 
Osmand
Super User
Super User

Re: Further advance filtering on Charts

My bad, yes the Left function was incorrect. Try this: 

 

If(Dropdown2_1.Selected.Value="All",SalesSumbyLocation,Filter(SalesSumbyLocationLeft(Grouped.SalesYear, Find(Grouped.SalesYear,".")) = Text(Dropdown2_1.Selected.Value)))

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit Bhatia
https://www.thepoweraddict.com

Re: Further advance filtering on Charts

Thank you @PowerAddict 

 

But still the = sign says Invalid argument type

 

 
Super User
Super User

Re: Further advance filtering on Charts

Do me a favor please. On either side of the equation, if you keep your cursor, it should tell you the data type. Let me know what those are.

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution. Thanks!

Hardit Bhatia
https://thepoweraddict.com

Helpful resources

Announcements
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (4,548)