Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Count between 2 dates

Hello,

My logic below is not pulling the correct count when AdminDate=MedStartTime.  For instance, when AdminDate is 3/17/2017 and MedStartTime is 3/17/2017 when Given='Y', it needs to be a count of 1 and not 0. Could someone please assist?

IF((AdminDate>=MedStartTime and AdminDate<=MedDiscountieTime) and Given='Y', 1,0)

Thank you.

1 Solution

Accepted Solutions
prachisangewar
Creator
Creator

Hi,

Please check the Date Formats for all the Date columns, they should be in same format as you do not have any format on the formula.

View solution in original post

7 Replies
swuehl
MVP
MVP

Full context, please.

It would be best if you post a small sample QVW.

Digvijay_Singh

Formula you shared above looks fine, checked in frontend and backend, worked fine, may be prob is somewhere else -

Capture.PNG

Anil_Babu_Samineni

Try with True false Condition in your way with each row or you may share application to check. Image is not the correct reply

download.png

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
prachisangewar
Creator
Creator

Hi,

Please check the Date Formats for all the Date columns, they should be in same format as you do not have any format on the formula.

sumitjadhav
Creator II
Creator II

Hi Vishal,

Try The Below Expression,

-->> col111.JPG

Output:

outputcol111.JPG

Hope this Works,

Thank's & Regards,

Sumit Jadhav

Anonymous
Not applicable
Author

The issue was with the date format in my sql script. I used the same date format for all the 3 dates and the same formula worked fine. Thank you.

swuehl
MVP
MVP

The date (textual) format should not be a problem, if the values show an underlying numeric value as well, as all date field values should:

Get the Dates Right

A problem could arise if you are in fact coping with timestamps and just format these as dates (so there is still a numeric value, that for example shows a time around noon, but the text representation dismisses this part).

For example, it's not enough to use

Date(TIMESTAMP) as Date

you need to use

Date(Floor(TIMESTAMP)) as Date

or

Dayname(TIMESTAMP) as Date

to get rid of the time part.