Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
bhavvibudagam
Creator II
Creator II

YTD Expression

Hi Experts,

Can any one please help me on below requirement.

I have a date field called [Report Date] in DD/MM/YYYY format.

I have to calculate the YTD in the below set analysis

i.e, The number of issues that have been completed from jan 01 to till the previous month.


I have many years in filter pane i have to restrict to max(year) jan 01 to till the previous month

My set analysis expression is

=count({<Status={'Completed'}>}distinct Issues)

Please help me to write the above YTD expression.

Thanks in advance.

1 Solution

Accepted Solutions
sunny_talwar

Or this

=Count({<Status = {'Completed'}, [Report Date] = {">=$(=Date(YearStart(Max([Report Date])), 'DD/MM/YYYY'))<$(=Date(MonthStart(Max([Report Date])), 'DD/MM/YYYY'))"}, Month, Day, Week, Quarter>} DISTINCT Issues)

View solution in original post

4 Replies
sudhirpkuwar
Partner - Creator II
Partner - Creator II

try this

=count({<Status={'Completed'},[Report Date]={">=YearStart(Max([Report Date])) <MonthStart(Max([Report Date]))"}>}distinct Issues)


this will calculate from 1 st of Jan to Previous month end

shiveshsingh
Master
Master

Can you try this?


Count({<Status={'Completed'},[Report Date]=, DateNum={">=$(=Num(YearStart(Max(DateNum))))<=$(=Max(DateNum)-1)"}>} distinct Issues)



..

where DateNum = Floor([Report Date])

Anil_Babu_Samineni

May be this?

=count({<Status={'Completed'}, DateField = {">=$(=YearStart(Max(DateField)))<=$(=AddMonths(Max(DateField),-1))"}, Month, Day, Week, Quarter>}distinct Issues)

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
sunny_talwar

Or this

=Count({<Status = {'Completed'}, [Report Date] = {">=$(=Date(YearStart(Max([Report Date])), 'DD/MM/YYYY'))<$(=Date(MonthStart(Max([Report Date])), 'DD/MM/YYYY'))"}, Month, Day, Week, Quarter>} DISTINCT Issues)