Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
t_donnet
Partner - Creator
Partner - Creator

SQL to set analysis: Date field between two other date fields

Hi,

I've this SQL query that i'ld to translate in set analysis:

select c.name, o.oderNum, s.NB, s.TotalSales
from Sales s, Client c, Order o
where s.condition = 20
and s.orderId = o.orderId
and o.clientId = c.clientId
and convert(date,CONVERT(varchar, s.SalesDate),112) between o.ValidFrom and o.ValidTo ;
and convert(date,CONVERT(varchar, s.SalesDate),112) between c.ValidFrom and c.ValidTo ;

this query is the base for the app and this is an simple example. The case is more complicated.
Fields date are in format 'DD.MM.YYYY'

How to translate in set analysis the dates of 'SalesDate' must be between the dates of 'ValidFrom' and 'ValidTo' of each tables?

Thanks for your help.

Regards, 
Théo

Labels (3)
2 Replies
Anil_Babu_Samineni

Set analysis can be done on aggregate basis at least per one measure column. As i can see, You can use modifier for above one like {<SalesDate={"=SalesDate>=ValidFrom and SalesDate<=ValidTo"}>}

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
t_donnet
Partner - Creator
Partner - Creator
Author

Hi,

I tried different ways with your answer. The result isn't there.

How bank company use this kind SQL request in Qlik Sense? Do you think Qlik has a limit?

Regards,