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: 
asinghal0412
Partner - Creator
Partner - Creator

YTD

Dear Qlik Community,

I have a measure, '% duly completed', which is as follows in set analysis

num(
count(
{<[Deliverable Status]={'Completed','Approved'},
[Deliverable Due to Date] = {1}>}
[Deliverable _Key])
/
sum ({<[Deliverable Status]-={'Waived'},
[Deliverable Due to Date] = {1}>} [Deliverable Due to Date])

Now I want to add an additional condition in this measure to filter the data as per YTD which displays results from Jan 2021 to current. So the new code is:

num(
count(
{<
Date=,Year=,Month=,Quarter=,today()={">=$(=YearStart(today()))<=$(today())"},
[Deliverable Status]={'Completed','Approved'},
[Deliverable Due to Date] = {1}>}
[Deliverable _Key])
/
sum ({<[Deliverable Status]-={'Waived'},
[Deliverable Due to Date] = {1}>} [Deliverable Due to Date])

It says there is an error in the Set modifier function, can someone help me? If the statement of the code is unclear please let me know!

best,

AS

 

 

 

 

Labels (2)
3 Replies
JuanGerardo
Partner - Specialist
Partner - Specialist

You can try Date={">=$(=YearStart(today()))<=$(today())"}instead of today()={">=$(=YearStart(today()))<=$(today())"} as the left side of the equal sign has to be a field, not a function.

JG

asinghal0412
Partner - Creator
Partner - Creator
Author

Hey Juan,

Thanks for your support!

The problem is it shows the data from 2018 till 2021 but I need only from Jan 2021 till present. Also, there is not field as Date() in the system, will your code still work?

Can you share the full code too? Thanks!

Best,

AS

MayilVahanan

HI @asinghal0412 

Hope you've any date field in your data model inorder to derive Year, Month, Quarter, Week etc. In that case, you can change the expression like below

num(
count(
{<
Year=,Month=,Quarter=,DateField={">=$(=Date(YearStart(today()),'YourDateFormat'))<=$(=Date(today(),'YourDateFormat'))"},
[Deliverable Status]={'Completed','Approved'},
[Deliverable Due to Date] = {1}>}
[Deliverable _Key])
/
sum ({<[Deliverable Status]-={'Waived'},Year=,Month=,Quarter=,DateField={">=$(=Date(YearStart(today()),'YourDateFormat'))<=$(=Date(today(),'YourDateFormat'))"},[Deliverable Due to Date] = {1}>} [Deliverable Due to Date])

Thanks & Regards, Mayil Vahanan R
Please close the thread by marking correct answer & give likes if you like the post.