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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
danosoft
Specialist
Specialist

Set Analisys with And, Or operator together

Hi i have this set analisys in my expression:


Sum({<DATA_OUT={">$(=Date($(vFineMonthContrAlt), 'DD/MM/YYYY'))<=$(=Date($(vFineMonthContrAltSCAD), 'DD/MM/YYYY'))"}> * (<STATO_OUT={'SCADENZA'}> + <STATO_OUT={'CESSATO'}>)} CONSUMO_TOT_ANNUO)

The problem is i want to do an AND operator from this:

<DATA_OUT={">$(=Date($(vFineMonthContrAlt), 'DD/MM/YYYY'))<=$(=Date($(vFineMonthContrAltSCAD), 'DD/MM/YYYY'))"}> * <STATO_OUT={'SCADENZA'}>

And an OR operator from this:

<STATO_OUT={'SCADENZA'}> + <STATO_OUT={'CESSATO'}>

But in the way i did it it not works; it only take me only the STATO_OUT='SCADENZA' does not consider STATO_OUT='CESSATO'


where is the problem?

thanks

1 Solution

Accepted Solutions
Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you want to get set analysis for a pseudo expression like this:

(Date1 < DATA_OUT <= Date2) AND (STATO_OUT = 'SCADENZA' OR STATO_OUT = 'CESSATO')

then write your actual expression like:

Sum({<DATA_OUT={">$(=Date($(vFineMonthContrAlt), 'DD/MM/YYYY'))<=$(=Date($(vFineMonthContrAltSCAD), 'DD/MM/YYYY'))"}> + <STATO_OUT={'SCADENZA', 'CESSATO'}>} CONSUMO_TOT_ANNUO)


or even simpler (relying on the implicit behavior of set analysis):


Sum({<DATA_OUT={">$(=Date($(vFineMonthContrAlt), 'DD/MM/YYYY'))<=$(=Date($(vFineMonthContrAltSCAD), 'DD/MM/YYYY'))"}, STATO_OUT={'SCADENZA', 'CESSATO'}>} CONSUMO_TOT_ANNUO)


If this is not what you want, then please provide an example using field values and required output.

View solution in original post

2 Replies
Peter_Cammaert
Partner - Champion III
Partner - Champion III

If you want to get set analysis for a pseudo expression like this:

(Date1 < DATA_OUT <= Date2) AND (STATO_OUT = 'SCADENZA' OR STATO_OUT = 'CESSATO')

then write your actual expression like:

Sum({<DATA_OUT={">$(=Date($(vFineMonthContrAlt), 'DD/MM/YYYY'))<=$(=Date($(vFineMonthContrAltSCAD), 'DD/MM/YYYY'))"}> + <STATO_OUT={'SCADENZA', 'CESSATO'}>} CONSUMO_TOT_ANNUO)


or even simpler (relying on the implicit behavior of set analysis):


Sum({<DATA_OUT={">$(=Date($(vFineMonthContrAlt), 'DD/MM/YYYY'))<=$(=Date($(vFineMonthContrAltSCAD), 'DD/MM/YYYY'))"}, STATO_OUT={'SCADENZA', 'CESSATO'}>} CONSUMO_TOT_ANNUO)


If this is not what you want, then please provide an example using field values and required output.

danosoft
Specialist
Specialist
Author

The first expression not work, but work the second:

Sum({<DATA_OUT={">$(=Date($(vFineMonthContrAlt), 'DD/MM/YYYY'))<=$(=Date($(vFineMonthContrAltSCAD), 'DD/MM/YYYY'))"}, STATO_OUT={'SCADENZA', 'CESSATO'}>} CONSUMO_TOT_ANNUO)

thanks