Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Rabia_Taimur
Contributor III
Contributor III

Dynamic YTD stats for current fiscal year

I have a data for multiple months. Need to show YTD stats for current fiscal year. do not want to hard code current fiscal year:

I am using below code but it isn't working:

=Count(Distinct if([Training Start date.Fisc.Year]=Max([Training Start date.Fisc.Year]),TITLE))

 

I have also created a variable and used code in data load editor as below:

Date(today()) as Date_Today

In visualization as below:

=Count(Distinct if([Training Start date.Fisc.Year]=$(Date_Today.Fisc.Year),TITLE))

but its not working 😞

 

 

 

1 Solution

Accepted Solutions
Rohan
Specialist
Specialist

Hi Rabia,

The "Title" needs to be in all caps "TITLE". Also make the following change :

Count({<[Training Start date.Fisc.Year]={">=$(=date(yearstart(max([Training Start date.Fisc.Year]),0,4)))<=$(=date(max([Training Start date.Fisc.Year])))"}>} TITLE)

Kindly check such field names stuff at your end too..

Regards,

Rohan.

View solution in original post

7 Replies
Rohan
Specialist
Specialist

Hi Rabia,

You need to use a simple Set analysis expression for YTD in this case, Try the following :

Count({<[Training Start date.Fisc.Year]={">=$(=yearstart([Training Start date.Fisc.Year],0,4))<=$(=max([Training Start date.Fisc.Year]))"}>} Title)

 

Note: Adjust the yearstart() parameters according to your fiscal year start.

Regards,

Rohan.

Rabia_Taimur
Contributor III
Contributor III
Author

Thank you for the quick response. I have tried the code but its still giving me attached error.

 

I am just getting started with set analysis, not very comfortable with it so i was trying to handle it with coding in data load editor.

 

 

Rohan
Specialist
Specialist

Hi Rabia,

My bad, here's an edit :

Count({<[Training Start date.Fisc.Year]={">=$(=yearstart(max([Training Start date.Fisc.Year]),0,4))<=$(=max([Training Start date.Fisc.Year]))"}>} Title)

Also, Is this field "[Training Start date.Fisc.Year]" in date form or num form ?

 

Regards,

Rohan.

Rabia_Taimur
Contributor III
Contributor III
Author

Its in Date format

Rabia_Taimur
Contributor III
Contributor III
Author

and its still not working 😞

Screen shot attached

Rohan
Specialist
Specialist

Hi Rabia,

The "Title" needs to be in all caps "TITLE". Also make the following change :

Count({<[Training Start date.Fisc.Year]={">=$(=date(yearstart(max([Training Start date.Fisc.Year]),0,4)))<=$(=date(max([Training Start date.Fisc.Year])))"}>} TITLE)

Kindly check such field names stuff at your end too..

Regards,

Rohan.

Rabia_Taimur
Contributor III
Contributor III
Author

Thank you so much for the help, much appreciated!