Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

No of days

Good morning guys,

I have made a column with the expression DAY(MONTHEND(MAKEDATE(PostingYear,PostingMonth))) to show the number of days in a month as shown in the image below

This works fine until I selected say 2013, the Days column only shows the days in 2013 only as shown in the image below

And adds up to the weirdness to it is that, say I select 2013 - May, it will on show the days for May 2013 only as show in the image below

For you info,

  • the Revenue column expression is --

         SUM({<PostingYear=, PostingMonth=, EndPostingDate=, PostingDateNum={"<=$(=Max(PostingDateNum))"}>}
   
RevAmount)/1000

  • the Days column expression is --

       DAY(MONTHEND(MAKEDATE(PostingYear,PostingMonth)))

  • the AR YTD expression is --

       SUM({<PostingYear=, PostingMonth=, EndPostingDate=, PostingDateNum={"<=$(=Max(PostingDateNum))"}>}
   
ARAmountYTD)/1000     

Can somebody point out what I'm missing in my Days expression?

Thank you so much for your kind attention guys

1 Solution

Accepted Solutions
SergeyMak
Partner Ambassador
Partner Ambassador

If you have Calendar as dimensional table (it's the best practice) you can calculate the number of days in this table and use

Only({$<Calendar.Month=,Calendar.Year=>}NoOfDays)

or just

For No of days it's better

Count({$<Calendar.Month=,Calendar.Year=>}Distinct Calendar.Date)

because you need to clear your year and month selection in set analysis for the expression

Regards,
Sergey

View solution in original post

2 Replies
SergeyMak
Partner Ambassador
Partner Ambassador

If you have Calendar as dimensional table (it's the best practice) you can calculate the number of days in this table and use

Only({$<Calendar.Month=,Calendar.Year=>}NoOfDays)

or just

For No of days it's better

Count({$<Calendar.Month=,Calendar.Year=>}Distinct Calendar.Date)

because you need to clear your year and month selection in set analysis for the expression

Regards,
Sergey
Not applicable
Author

Oh my why I didn't think of that. Thank you very much bro!