Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
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

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

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

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

It worked?

zied_ahmed1
Specialist
Specialist
Author

Yes Sunny Thank you