cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
AGS94
Resolver I
Resolver I

Adding and Filtering Numeric Columns in a Collection

Referring to the attached JPG, I am trying to to do two things:

1) Add numeric columns to a collection (no matter what I have tried they always show up as text)

2) Filter by the GrpAll column

 

I created columns GrpCol, GrpFst and GrpMat and set them = 1 (not "1") when the respective Color, Fastener and/or Material is selected from a checkbox. I also set them to = 0 when the respective box is unchecked. I then created the GrpAll column by taking the average of these three columns (I am doing all of this to set up subsequent filtering).

 

As you can see, it is working up to this point, but as soon as I filter the GrpAll, the fractions all turn to 1, thus defeating the purpose. Also, oddly if I filter by any of the other three "Grp" columns, some fo the GrpAll fractions flip to 1 and some do not (ex. some 0.3333 remain 0.3333, but some change to 1).

 

What am I doing wrong?Capture.JPGCapture2.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
AGS94
Resolver I
Resolver I

Finally got the Max() formula figured out. Problem solved.

View solution in original post

3 REPLIES 3
Pstork1
Dual Super User III
Dual Super User III

Two things

1) Can you explain a bit more about how you are doing the calculation that gets added to the collection?  I was able to setup a static collection with numeric fields and had no issues.  I suspect there is some interaction  between the way you are calculating and saving the values that is causing the problem.

2) Rather than working with the averages why not just Sum the columns?  The ranking would be the same, but then you are working with integers not whole number fractions.  If the issue is rounding then that would no longer be an issue.  

 

But I suspect the issue is inolved with the Checkboxes.  Those generate a true false value that can be interpreted as 1/0, but it isn't actually the same as an integer.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Following is the formula that adds the GrpAll column. I had changed to sum vs average shortly after my original post for the reasons you mention. I have been trying to use Value() everywhere possible in the hopes everything would remain numeric.

 

UpdateIf(CollJak,(GrpCol+GrpFst+GrpMat)>0,{GrpAll:Value(GrpCol+GrpFst+GrpMat)})

Following is how I am adding the other "GrpXXX" columns via the OnCheck and OnUncheck for each checkbox:

 

UpdateIf(CollJak,Color="Red",{GrpCol:Value(1)})

(for OnUncheck, Value(1) is Value (""). I just added "Value" a few minutes ago hoping to "force" numeric. Previously they were simply 1 and "" (the one was without quotes). Now that I am summing, I will try changing the "" back to 0. Not sure that will help in any way.

 

I have a Data Table being populated by the CollJak collection so I can see how things are working. If I use either of the following in the Items property of the table, it will filter as expected. 

 

Filter(CollJak,GrpAll="3")

Filter(CollJak,Value(GrpAll)=3)

Of course, GrpAll could be 0,1,2 or 3 depedning on what (if any) checkboxes are selected, so I ultimately need to filter GrpAll by that column's maximum value. I have tried MAX() several different ways, but can't seem to figure it out. At this point, I am getting myself wrapped around the axle I think.

 

AGS94
Resolver I
Resolver I

Finally got the Max() formula figured out. Problem solved.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,869)