Qlik Community

QlikView Extensions

Discussion Board for collaboration on QlikView Extensions.

Highlighted
Not applicable

I have to calculate sum of sales, condition is I have to sum sales for last week only.I have date field called Date_D that has all the dates. I want to make my set expression dynamic ..How Can I do with Variables and with out variables.

Hi ,

I have to calculate sum of sales, condition is I have to sum sales for last week only.I have  date field called Date_D that has all the dates. I want to make my set expression dynamic ..How Can I do with Variables and with out variables.

one more query,

In this query, I need to calculate sum sales for yesterday date , but I can not use Today()-1 as on Moday, it will fetch Sundy Data and I dont have any data for sunday,

I tried this logic

date(if(WeekDay(today())='Mon',(today()-3),(today()-1))

but how to use in Set Expression or by using variables?

Thanks in Advance !!

Sid

3 Replies
Frank_Hartmann
Honored Contributor

Re: I have to calculate sum of sales, condition is I have to sum sales for last week only.I have date field called Date_D that has all the dates. I want to make my set expression dynamic ..How Can I do with Variables and with out variables.

can you share a sample?

galax_allu
Valued Contributor

Re: I have to calculate sum of sales, condition is I have to sum sales for last week only.I have date field called Date_D that has all the dates. I want to make my set expression dynamic ..How Can I do with Variables and with out variables.

Hi



=Sum({<Date_D = {">=$(=Date(Today()-6,'MM/DD/YYYY'))<=$(=Date(Today(),'MM/DD/YYYY'))"}>} sales)……………………………….FOR SELECTING last 7 days sales






Re: I have to calculate sum of sales, condition is I have to sum sales for last week only.I have date field called Date_D that has all the dates. I want to make my set expression dynamic ..How Can I do with Variables and with out variables.

Or may be this:

=Sum({<Date_D = {"$(='>=' & Date(Max(Date_D) - 6, 'DateFieldFormatHere') & '<=' & Date(Max(Date_D),'MM/DD/YYYY'))"}>} sales)

This will show past one week based on your selection in Date_D field.

Best,

Sunny