Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
THWTEMJIRAS
Contributor II
Contributor II

Aggr() and If Condition

I have tried to write this formula below for many days, but I found that there's no result from this formula. I'm very new to qlik sense. If anyone could help to correct my formula, it would help me a lot. Thanks!

if (num([Required delivery date]-num(today()) < aggr(xxx),'Yes')

=if(num([Required Delivery Date])-num(today())

<aggr({<[PO Number]=,[Material_Code]=,[PO Item Status]=>}sum(num(ATA)-num(ATD)),Material_Code)

/aggr({<[PO Number]=,[Material_Code]=,[PO Item Status]=>}count(num(ATA)-num(ATD)),Material_Code)

,'Yes')

Labels (4)
2 Replies
BrunPierre
Partner - Master
Partner - Master

Hi, maybe like this.

=If(
Num#([Required Delivery Date]) - Num#(Today())
<
Aggr(Sum({<[PO Number]=,[Material_Code]=,[PO Item Status]=>} Num#(ATA - ATD)), [Material_Code])
/
Aggr(Count({<[PO Number]=,[Material_Code]=,[PO Item Status]=>} Num#(ATA - ATD)), [Material_Code]),
'Yes')

THWTEMJIRAS
Contributor II
Contributor II
Author

Thank you so much for your help and suggestion. I have tried your formula, but I found that it's work only for some line, not all lines.   I don't know why  ☹️

Then, I have tried to remove "if statement" out and change "<"  to "-" from the formula to see whether it will display numeric result, or not. I found that it's still display only for some certain line as well.  Please see my screenshot below.

(Num#([Required Delivery Date]) - Num#(Today())
-
(Aggr(Sum({<[PO Number]=,[Material_Code]=,[PO Item Status]=>} Num#(ATA - ATD)), [Material_Code])
/
Aggr(Count({<[PO Number]=,[Material_Code]=,[PO Item Status]=>} Num#(ATA - ATD)), [Material_Code]))


Thanks.

THWTEMJIRAS_3-1690642275361.png