Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ch_riadh
Partner - Creator II
Partner - Creator II

Dates

Hi, 

i have 2 tables:

Table1: Field 1 ----> Date

                Field 2 ----> Sales

Table1: Field 1----> EventName

                Field 2 ----> DateFromCY

                Field 3 ----> DateToCY

 

I create 2 Variable :

vStartDateCY    :     =Date(DateFromCY)

vEndDateCY    :     =Date(DateToCY)

 

I want Sales for event period.

expression: Sum({<Date={">=$(vStartDateCY)<=$(vEndDateCY)"}>}Sales) 
Works fine when i select one event.

ev1.PNG

When Clear selection  gives me total sales.  😞

ev2.PNG

I want display Sales per Event.

Thanks

Labels (3)
4 Replies
Vegar
MVP
MVP

Whenever you do dollar expansions in a set expression you should consider the value as it is a variable defined outside of your chart. $(vStartDateCY) will have the same value for all rows in your chart and in your case it will probably be null as I assume you have more than one DateFromCY value in your selection. 

 

Have you considered using IntervalMatch  for modelling your data? 

ch_riadh
Partner - Creator II
Partner - Creator II
Author

hi vegar,

thank you for your response,

so do you have a solution for that ?

Vegar
MVP
MVP

Try to use interval match.

Sales:
LOAD  Date, Sales
FROM SALES;

Event:
LOAD DateFromCY, DateToCY, EventName 
FROM EVENT;

Inner Join IntervalMatch ( Date ) 
LOAD DateFromCY, DateToCY
Resident Event;

 

ch_riadh
Partner - Creator II
Partner - Creator II
Author

thank you. it works 

but i have an other issue 😞

Event:
LOAD 
EventName , DateFromCY, DateToCY,
EventNameComp, DateFromComp, DateToComp

FROM Event;

Date:
LOAD Date, Sales

FROM  Date;

 

Inner Join IntervalMatch ( Date)
LOAD


DateFromComp,
DateToComp

Resident Event; 

What about the Event comparable ???