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: 
LesJean
Contributor III
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
NZFei
Partner - Specialist
Partner - Specialist

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

View solution in original post

Channa
Specialist III
Specialist III

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

Channa

View solution in original post

jonathandienst
Partner - Champion III
Partner - Champion III

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
NZFei
Partner - Specialist
Partner - Specialist

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

Channa
Specialist III
Specialist III

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

Channa
jonathandienst
Partner - Champion III
Partner - Champion III

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
LesJean
Contributor III
Contributor III
Author

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