cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

How to sum a gallery column with Null or Non numbers inside

Hello everyone,

 

I have been trying to sum a gallery column that contains numbers with this bit :

 

Sum(Gal_Devis_Equipement_Acquisition_Base.AllItems; PrixTotHTBPU_EAB);;

 

So far it has been working fine but as I import data from a database, some values can be "Null" or "N/A" (which is intended).
My question is : how to sum everything except the non numeric values ?

I have tried this without success :

 

Sum(
    Filter((Gal_Devis_Equipement_Acquisition_Base.AllItems; PrixTotHTBPU_EAB); IsNumeric(PrixTotHTBPU_EAB));;
)

 

Thanks in advance !

2 REPLIES 2
Drrickryp
Super User
Super User

@Anonymous 

In the OnVisible property of the screen, put 

 

ClearCollect(
    gdeab,
    Gal_Devis_Equipement_Acquisition_Base
);
UpdateIf(
    gdead,
    PrixTotHTBPU_EAB = "N/A" || PrixTotHTBPU_EAB = "Null",
    {PrixTotHTBPU_EAB: 0}
)

 

Your filter should work correctly now if you use gdead as the data source for the gallery.  FYI: I wrote it as a collection in case you did not want to modify the original data source.  If that is not a problem you can run the update on the original data source to convert the text items to 0. 

Anonymous
Not applicable

Hi @Anonymous 

For different values (number and text) this formula must work

Sum(YourDataBase.YourColumn; ThisRecord.YourColumn);;

 For example I created list "Example". There is a column "Number And/or Text" with type - single line of text. There I have 7 Items with numbers, empty, "N/A" and "null". On screenshot you see gallery and formula at the top for label:

Sum(Example.'Number And/or Text',ThisRecord.'Number And/or Text')

Eduard_Pyvkach_0-1650474398122.png

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (6,225)