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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
zied_ahmed1
Specialist
Specialist

Condition not working

Hello,

I have this condition and it works :

sum( {<[Month of date]= >}

if( Pays='Maroc',

aggr(

if (Only({<[Month of date]>}Code_Ligne)='MAR',

(

Count({<$(vSetPeriodRange),Code_Ligne={'MAR'}, [Month of date]=,Flag_Doublon={1}>}Dossier)

/2

)

+

Count({<$(vSetPeriodRange),Code_Ligne={'MAR'},[Month of date]=,Timeframe=,Flag_Doublon={0}>}Dossier)

,

Count({<$(vSetPeriodRange), [Month of date]=>}Dossier))

, Pays, [Month of date]),

aggr(Count({<$(vSetPeriodRange), [Month of date]=>}Dossier)

,Pays, [Month of date])

)

)


But when i want to delete the condition if( Pays='Maroc',  it doesn't work :


sum( {<[Month of date]= >}

if (Only({<[Month of date]>}Code_Ligne)='MAR',

aggr(

(

Count({<$(vSetPeriodRange),Code_Ligne={'MAR'}, [Month of date]=,Flag_Doublon={1}>}Dossier)

/2

)

+

Count({<$(vSetPeriodRange),Code_Ligne={'MAR'},[Month of date]=,Timeframe=,Flag_Doublon={0}>}Dossier)

,

Count({<$(vSetPeriodRange), [Month of date]=>}Dossier)

, Pays, [Month of date]),

aggr(Count({<$(vSetPeriodRange), [Month of date]=>}Dossier)

,Pays, [Month of date])

)

)

Thank you

1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

May be try this:

Sum({<[Month of date]=>}

Aggr(

If(Only({<[Month of date]>} Code_Ligne)='MAR',


(Count({<$(vSetPeriodRange),Code_Ligne={'MAR'}, [Month of date]=,Flag_Doublon={1}>}Dossier)/2) +

Count({<$(vSetPeriodRange),Code_Ligne={'MAR'},[Month of date]=,Timeframe=,Flag_Doublon={0}>}Dossier),


Count({<$(vSetPeriodRange), [Month of date]=>}Dossier)),


Pays, [Month of date]))

View solution in original post

6 Replies
sunny_talwar
MVP
MVP

If you are removing the if condition, then remove the true or false condition also... try this

sum( {<[Month of date]= >}

if (Only({<[Month of date]>}Code_Ligne)='MAR',

aggr(

(

Count({<$(vSetPeriodRange),Code_Ligne={'MAR'}, [Month of date]=,Flag_Doublon={1}>}Dossier)

/2

)

+

Count({<$(vSetPeriodRange),Code_Ligne={'MAR'},[Month of date]=,Timeframe=,Flag_Doublon={0}>}Dossier)

,

Count({<$(vSetPeriodRange), [Month of date]=>}Dossier)

, Pays, [Month of date]),

aggr(Count({<$(vSetPeriodRange), [Month of date]=>}Dossier)

,Pays, [Month of date])

)

)

zied_ahmed1
Specialist
Specialist
Author

the problem is not solved yet when i remove

,

Count({<$(vSetPeriodRange), [Month of date]=>}Dossier)

sunny_talwar
MVP
MVP

May be try this:

Sum({<[Month of date]=>}

Aggr(

If(Only({<[Month of date]>} Code_Ligne)='MAR',


(Count({<$(vSetPeriodRange),Code_Ligne={'MAR'}, [Month of date]=,Flag_Doublon={1}>}Dossier)/2) +

Count({<$(vSetPeriodRange),Code_Ligne={'MAR'},[Month of date]=,Timeframe=,Flag_Doublon={0}>}Dossier),


Count({<$(vSetPeriodRange), [Month of date]=>}Dossier)),


Pays, [Month of date]))

zied_ahmed1
Specialist
Specialist
Author

Oh great ,problem resolved

Thank you Sunny

sunny_talwar
MVP
MVP

It worked?

zied_ahmed1
Specialist
Specialist
Author

Yes Sunny Thank you