Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
bsbernabe
Creator
Creator

count 1st and last date

Hello There,

How to count or apply in expression the first date to the last date?

sample data:

first date           |   last date

01/25/2017          06/06/2017

Ans.

=4 months


how can i  =Count(first date) to (last date)


I need you're Help guys.


Best Regards,

Bing

1 Solution

Accepted Solutions
luismadriz
Specialist
Specialist

Hi, Qlik stores dates as text and as numbers. You could try just LastDate-FirstDate and will give you the number of days in between, any decimal will be the difference in time. Once you have the number of days you can just divide it by 30 and get an estimation of the number of months.

If you need to truncate the decimals you could use Floor: Floor((LastDate-FirstDate)/30) and you'll get your 4 months

If LastDate-FirstDate doesn't work there could be an issue with the data type which is a different issue.

Hope this helps,

L

View solution in original post

3 Replies
Anil_Babu_Samineni

You need to create master calendar and simple expression using Count(Measure)

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
luismadriz
Specialist
Specialist

Hi, Qlik stores dates as text and as numbers. You could try just LastDate-FirstDate and will give you the number of days in between, any decimal will be the difference in time. Once you have the number of days you can just divide it by 30 and get an estimation of the number of months.

If you need to truncate the decimals you could use Floor: Floor((LastDate-FirstDate)/30) and you'll get your 4 months

If LastDate-FirstDate doesn't work there could be an issue with the data type which is a different issue.

Hope this helps,

L

bsbernabe
Creator
Creator
Author

Hi Luis,

Its working thank you so much.

Best Regards,

Bing