Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator II
Creator II

how to calculate no of months in a year along with completed days

Hello everyone,

I have to get the count of no of months, which also includes no of passing days  in a month as well.

For example I have two months data:-April and May

April month is competed now, so for April count is 1, and

for May only 3 days are completed so it should be around 0.10 approx.

The total count which I should get is 1.10, but I am getting 1.97 by using below formula:-

 

=round((Count({<date={">=$(=Yearstart(Max(date),0,4))<=$(=Monthend(Max(date),0))"}>}distinct FMonth)


+(Count({<date={">=$(=Monthstart(Max(date)))<=$(=(Max(date)))"},fYear={"$(=Year(Today()))"} >}distinct date)
/
(Monthend(Max(date))-Monthstart(Max(date))))


- Count({<fYearMonth={"$(=Year(Today()) & Num(Month(Today()),00))"}>}distinct 1)),0.01)

 

Please suggest.

 

Regards

 

Labels (1)
1 Solution

Accepted Solutions
Highlighted
Creator II
Creator II

Hello,

your expression also give me value as '2', that is not correct, it should give something around 1.23 as May month is still not completed.

However I have achieved that by doing some modification in my expression.

Thanks for you help.

 

 

 

View solution in original post

2 Replies
Highlighted
Partner
Partner

Multiple ways that lead to ROme. You can try this for instance:

Sum(Aggr(Count({<date={"<$(=Today())"}>} date) / Count(date),FMonth))

Highlighted
Creator II
Creator II

Hello,

your expression also give me value as '2', that is not correct, it should give something around 1.23 as May month is still not completed.

However I have achieved that by doing some modification in my expression.

Thanks for you help.

 

 

 

View solution in original post