# SUMIf date is between [daterange controller]

Hi,
can anyone provide the right column formula to SUMIf rows from another table if its date column is between [daterange controller] ? Preferably using Filter function, because I need to add multiple criteria as well.
I tried Matches formula but in each version it returns 0. (Even if I set up a dedicated boolean column to determine whether thisrow falls in the range. (answer is correct). Then SUMIf those… Still 0. SUM column type is Number)

Hi @Balint_Drahota - Welcome to the community!

Can you take a look at this and see if it helps you?

I created a date range controls and this is the formula I used for SumIf
thisTable.Filter(Date.Matches([Date Range picker]) andItem=thisRow.Item).Cost.Sum()

I also added a filter ot the “items” table in case you wanted the sum there too.
[SumIF Example].Filter(Date.Matches([Date Range picker]) and Item=thisRow).Cost.Sum()

I applied your 2nd formula in the Epics table’s Price in date range column, but still returns 0 for all row. Maybe the problem is that the display column is not the same as in the “Tasks” table.

Please edit the formulas in Price in date range and the Duration in date range columns.

Can you share a sample doc here and I can work directly in that with you? Thanks !

I’ve edited my previous comment to be more informative, including sample doc I think this is what you were looking for For the `Price`

`Tasks.Filter([Done date]>=[daterangepicker 1].First() AND [Done date]<=[daterangepicker 1].Last() AND Epic.[Epic Name]=thisRow.[Epic Name]).Price.Sum()`

And for the `Duration`

`Tasks.Filter([Done date]>=[daterangepicker 1].First() AND [Done date]<=[daterangepicker 1].Last() AND Epic.[Epic Name]=thisRow.[Epic Name]).Worked.Sum()`

I don’t know why but I had to rewrite the formulas to get them to work.

2 Likes

Thanks so much!
I didn’t know that I should use First and Last with date ranges, and NOT Min and Max.

1 Like

You’re welcome A tiny note :

• `Min()` and `Max()` are used with numbers • `First()` and `Last()` is generally for everything that is not a number (like here with the dates )

But it can depend of the use case and the expected results
{"ft_lang_label":"__label__en","ft_lang_prob":0.84389085,"math_prob":0.7809988,"size":2141,"snap":"2019-43-2019-47","text_gpt3_token_len":518,"char_repetition_ratio":0.112306975,"word_repetition_ratio":0.034883723,"special_character_ratio":0.23587109,"punctuation_ratio":0.10930233,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.95735574,"pos_list":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],"im_url_duplicate_count":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2019-11-21T08:42:34Z\",\"WARC-Record-ID\":\"<urn:uuid:5e7d34ef-7134-4558-b618-7fbc5cd9aa0f>\",\"Content-Length\":\"24744\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:e67e3f51-d9ab-48cf-aac9-82c3f11ddf12>\",\"WARC-Concurrent-To\":\"<urn:uuid:97cbdc26-ead2-48b9-80db-8b7c939958aa>\",\"WARC-IP-Address\":\"72.52.80.23\",\"WARC-Target-URI\":\"https://community.coda.io/t/sumif-date-is-between-daterange-controller/11682\",\"WARC-Payload-Digest\":\"sha1:6L7337TMW6K7PDX4TMI5ACIG73EASXLV\",\"WARC-Block-Digest\":\"sha1:MEU2XIIGCBL2XEWCF6JOATIBS2ST6IVX\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2019/CC-MAIN-2019-47/CC-MAIN-2019-47_segments_1573496670743.44_warc_CC-MAIN-20191121074016-20191121102016-00349.warc.gz\"}"}