Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

LesJean
New Contributor III

Counts return different results

Hello everyone,

So I need to do a count on a set of data.  Here's a line of code that works for me and that returns the right result, which is a value of 132.

Count({<tblCommande_QteBO = {">0"}, tblArticleBO_StoreLoc = {'1000'}, tblCommande_Dt_orig_ch_FORMATTED = {"<=08.03.2019"} >} Distinct(Article))

I need to make the tblCommande_Dt_orig_ch_FORMATTED condition more dynamic, so I tried using the Today() function, like so:

Count({<tblCommande_QteBO = {">0"}, tblArticleBO_StoreLoc = {'1000'}, tblCommande_Dt_orig_ch_FORMATTED = {"<=$(Today() - 3)"}>} Distinct(Article))

And yet, this line returns a count of 133. I've checked and "Today() - 3" returns 08.03.2019 which should be correct.

Does anyone know if I have an error in my syntax?

Thank you,

LesJean

3 Solutions

Accepted Solutions
Partner
Partner

Re: Counts return different results

Count({<tblCommande_QteBO = {">0"}, tblArticleBO_StoreLoc = {'1000'}, tblCommande_Dt_orig_ch_FORMATTED = {"<=$(=date(Today() - 3))"}>} Distinct(Article))

View solution in original post

Channa
Valued Contributor III

Re: Counts return different results

Count({<tblCommande_QteBO = {">0"}, tblArticleBO_StoreLoc = {'1000'}, tblCommande_Dt_orig_ch_FORMATTED = {">=$(=date(Today(),-3))"}>>} Distinct Article)

Channa

View solution in original post

MVP
MVP

Re: Counts return different results

This:

Count({<tblCommande_QteBO = {">0"}, 
	tblArticleBO_StoreLoc = {'1000'}, 
	tblCommande_Dt_orig_ch_FORMATTED = {"<=$(=Today() - 3)"}
>} Distinct(Article))

or this:

Count({<tblCommande_QteBO = {">0"}, 
	tblArticleBO_StoreLoc = {'1000'}, 
	tblCommande_Dt_orig_ch_FORMATTED = {"<=$(=Date(Today() - 3), 'DD.MM.YYYY)"}
>} Distinct(Article)) 

 

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

4 Replies
Partner
Partner

Re: Counts return different results

Count({<tblCommande_QteBO = {">0"}, tblArticleBO_StoreLoc = {'1000'}, tblCommande_Dt_orig_ch_FORMATTED = {"<=$(=date(Today() - 3))"}>} Distinct(Article))

View solution in original post

Channa
Valued Contributor III

Re: Counts return different results

Count({<tblCommande_QteBO = {">0"}, tblArticleBO_StoreLoc = {'1000'}, tblCommande_Dt_orig_ch_FORMATTED = {">=$(=date(Today(),-3))"}>>} Distinct Article)

Channa

View solution in original post

MVP
MVP

Re: Counts return different results

This:

Count({<tblCommande_QteBO = {">0"}, 
	tblArticleBO_StoreLoc = {'1000'}, 
	tblCommande_Dt_orig_ch_FORMATTED = {"<=$(=Today() - 3)"}
>} Distinct(Article))

or this:

Count({<tblCommande_QteBO = {">0"}, 
	tblArticleBO_StoreLoc = {'1000'}, 
	tblCommande_Dt_orig_ch_FORMATTED = {"<=$(=Date(Today() - 3), 'DD.MM.YYYY)"}
>} Distinct(Article)) 

 

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein

View solution in original post

LesJean
New Contributor III

Re: Counts return different results

Thanks to all 3 of you guys, these solutions work!