Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

last 4 weeks graph

Hi All,

  I want to create a bar chart which calculate frequency within last 4 weeks.

I have a variable "MAX_FULL_DAY_DATA_DATE" which stores the maximum date and the format is date-time

here is my calculation, but the graph doesn't show anything:

=sum(if (DATE_VALUE <= date($(MAX_FULL_DAY_DATA_DATE),'mm,dd YYY') AND DATE_VALUEdate($(MAX_FULL_DAY_DATA_DATE)-28,'mm,dd YYY'), Frequency))

Can you please help?

thank you,

Nasim

Labels (1)
4 Replies
Anonymous
Not applicable
Author

hello,

try you this

sum(if (num(DATE_VALUE) <= num($(MAX_FULL_DAY_DATA_DATE)) AND num(DATE_VALUE) > num($(MAX_FULL_DAY_DATA_DATE)) - 28, Frequency))

its_anandrjs
Champion III
Champion III

Hi,

Write some thing like below but i suggest change the date format of variable in variable part like 'mm,dd YYY' and you use here only

=sum(if (DATE_VALUE <= $(MAX_FULL_DAY_DATA_DATE) AND DATE_VALUE > ($(MAX_FULL_DAY_DATA_DATE)-28), Frequency))


Hope this helps

Thanks & Regards

Ferran_Garcia_Pagans
Former Employee
Former Employee

I use 'set analisys' for this kind of problems.

# 1st Covert the data to integer

var_DateMax=num($(MAX_FULL_DAY_DATA_DATE))

# 2nd Calculate initial date

var_DateMin=$(var_DateMax)-28

# 3rd Use set analysys to calculate the expression

sum({$<DATE_VALUE = {'>=$(var_DateMin)<=$(var_DateMax)'}>} Frequency)

Ferran

Not applicable
Author

Thanks all,

Unfortunately, none of them are working. when I put any condition on Date_Value, I got an error.

the Date_Value has a date format.