Skip to main content

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
Welcome to Qlik Community! Check out our new navigation! FIND OUT MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
davyqliks
Specialist
Specialist

Date range from to

Hi,

I need to make some set analysis to show the last 2 weeks of data only.

I have made in the calendar a Cumulative week function and when i use the following i get the correct return

=sum({<
[%_CumWeekNo] = {"$(=max(%_CumWeekNo)-2)"}


>}[Ticket Qty])

 

I have tried the follwing:

 

=sum({<
[%_CumWeekNo] => {"$(=max(%_CumWeekNo)-2)"}


>}[Ticket Qty])

 

and also

 

=sum({<
[%_CumWeekNo] => {"$(=max(%_CumWeekNo)-2)"}..[%_CumWeekNo] => {"$(=max(%_CumWeekNo))"}


>}[Ticket Qty])

 

PLease can anyone assist in me achieving 2 weeks of data using the %_CumWeekNo.

Thank you in advance

Labels (2)
1 Solution

Accepted Solutions
Chanty4u
MVP
MVP

try this

sum({<[Date]={">=$(=Weekstart(WeekName(max([Date]),-2)))<=$(=Weekend(WeekName(max([Date]))))"}>}[Ticket Qty)

View solution in original post

6 Replies
Chanty4u
MVP
MVP

try this

sum({<[Date]={">=$(=Weekstart(WeekName(max([Date]),-2)))<=$(=Weekend(WeekName(max([Date]))))"}>}[Ticket Qty)

davyqliks
Specialist
Specialist
Author

Thank you for the response, 

Should i be replacing the WeekName with my value %_CumWeekNo?

 

Before i start to replace value i see an error in the syntax, please can you advise where the issue is:

davyqliks_0-1647011156103.png

Thanks for your help.

Daniel

 

 

Chanty4u
MVP
MVP

just change your date field..........instead of  "date"

davyqliks
Specialist
Specialist
Author

Thank you Chanty4U,

I have replaced the data and see below the date is returning a value but i cannot workout where the syntax is wrong to not show the [Send Date] as a dimension:

Are you able to assist? thanks

Daniel

davyqliks_0-1647012790491.png

 

Chanty4u
MVP
MVP

you missed  ]   at the end of Qty

sum({<[Date]={">=$(=Weekstart(WeekName(max([Date]),-2)))<=$(=Weekend(WeekName(max([Date]))))"}>}[Ticket Qty])

davyqliks
Specialist
Specialist
Author

Thank you so much,

I copied the original which didnt have the ] but i should have noticed,

Really appreciate your time and effort on helping me with this,

davyqliks_0-1647016472198.png