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

Chart based on Today()

Hi All

I want to create the chart which counts the ID based on the following date values Today()-14,Today-30,Today()-90 and YTD. I thought of doing it by passing these days values in the cyclic group. Is it the right way of doing it. I am little confused how to do this. Does any one have sample application which does the same thing? If you can attach it will be helpful for me.

Regards

Attitude

22 Replies
swuehl
MVP
MVP

Hi,

If I understood correctly you might use set analysis for that:

YTD:

=count({<Date={">=$(=yearstart(today()))"}> ID}

Today-14 till today:

=count({<Date={">=$(=today()-14)"}> ID}

etc.

Use this as expression in a chart (just for comparison of these values, you don't need a dimension).

Is this something you intended?

Stefan

Not applicable
Author

Hi Stefan

Thanks for your response! Still I haven't decided which will be the best way to develop this chart. I want to create the chart which is effective enough for the end user to analysis their data.

If you find free time you can give some suggestion on this.

I am welcoming all your suggestion. Please help me out!

Regards

Attitude

Not applicable
Author

Hi Stefen

Just for your information. There is one small mistake in the expression which you have recommended for me.

YTD:

=count({<Date={">=$(=yearstart(today()))"}>} ID)


Today-14 till today:

=count({<Date={">=$(=today()-14)"}>} ID)


Regards

Attitude

swuehl
MVP
MVP

Yeah, needs to get my eyes checked!

I wrote the expressions on my way home without checking, sorry for that.

I may also misunderstood your original question, I now think you were asking about the way to present your data, not to calculate them..

You could probably use a cyclic group or container to switch between the different values, but I am not sure if this the best way if you are not really out of real estate.

Maybe I would just show them side by side in a table or bar chart, but the periods for which the values are calculated differ, so you can't really compare them one to another, so I would make it pretty clear, what the difference (i.e. period) is. If these values are known KPIs, showing them all side by side (or in distinct objects, side by side) would be ok, I think.

It could also be valuable if you would compare the distinct values to e.g. last years values.

Do you want to share a sample application?

Regards,

Stefan

Not applicable
Author

Hi Stefen

I think instead of using <= we need to use >=, as we are count based on Today() to Today()-14. What do you say? I am little confused with this expression plese clear my doubt. Hope needs are clear are for you.

YTD:

=count({<Date={"<=$(=yearstart(today()))"}>} ID)


Today-14 till today:

=count({<Date={"<=$(=today()-14)"}>} ID)

etc.


Regards

Attitude

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

   You should use the  >= sign.

   Let me explain how it works.

   =count({<Date={">=$(=yearstart(today()))"}>} ID)

   Here you are saying give me count of ID where the date is greater than the current yearstart.

   Same way

   =count({<Date={">=$(=today()-14)"}>} ID)

   Here you are saying give me count of ID where the date is greater than the today() -14.

   So here if today is 15-05-2011 it will give you 01-04-2011

 

    Hope this will help you.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
swuehl
MVP
MVP

I don't think so, or have not understand your requirement:

above expression would translate using yearstart(today()) ---> 2011-01-01

to "count all IDs with Date <= 2011-01-01"

Similar, second expression would translate to "count all IDs with Date <= 2011-07-12

Regards,

Stefan

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

   Let me explain you again.

   =count({<Date={">=$(=today()-14)"}>} ID)

   As i said consider if today is 15-04-2011 then the function today() -14 will give you 01-04-2011

   So accodring to the above expression you will get the count of ID's where the date is Greater than the 01-04-2011.

   So the Id's whos date is lower then 01-04-2011. i.e for example 02-02-2011 will be ignored.

   Now its up to you, that you want to cound the ID's which are greater then ot lesser then the date specified in expression i.e today()- 14.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
swuehl
MVP
MVP

Hi Kaushik,

my post was also related to at titudes question, not to yours, I have seen yours just after posting.

I think our both posts essentially agree.

Regards,

Stefan