Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
qlikster
Contributor III
Contributor III

Set an expression result as a filter for end user

Hi,

I'm trying to give the end user the possibility to filter on an expression:

 

if(OrderStatus='Makulerad',0, If ((sum(confirmed_quantity) < sum(ordered_quantity)), (sum(confirmed_quantity) - sum(delivered_quantity)), (sum(ordered_quantity) - sum(delivered_quantity))))

They want to be able to filter on everything over 0, everything under 0 and 0 which works when using smart search >0, <0, 0 and so on.

I've tried putting this in an calculated dimension with aggr and that sort of works but I need to aggr over a lot of dimensions so it's not a good solution.

 

I've also tried aggregation in the script outside the fact table and then join the results to the fact table on OrderId.

But I get an error:

The following error occurred:
Error in expression: Nested aggregation not allowed:
 
SumOverUnder:
Load [Supplier Order ID],
sum(if(OrderStatus='Makulerad',0, If ((sum(confirmed_quantity) < sum(ordered_quantity)), (sum(confirmed_quantity) - sum(delivered_quantity)), (sum(ordered_quantity) - sum(delivered_quantity))))) as OverUnderDelSum
Resident Facts group by [Supplier Order ID];

 

 

Any ideas?

Labels (1)
1 Reply
anat
Master
Master

SumOverUnder:
Load [Supplier Order ID],
if(OrderStatus='Makulerad',0,
If ((sum(confirmed_quantity) < sum(ordered_quantity)), (sum(confirmed_quantity) - sum(delivered_quantity)), (sum(ordered_quantity) - sum(delivered_quantity)))) as OverUnderDelSum
Resident Facts group by [Supplier Order ID];


or

SumOverUnder:
load [Supplier Order ID],
if(OrderStatus='Makulerad',0,
If (cq < oq, cq - dq,oq- dq) as OverUnderDelSum
;
Load [Supplier Order ID],
sum(confirmed_quantity) as cq,
sum(ordered_quantity) as oq,
sum(delivered_quantity) as dq

Resident Facts group by [Supplier Order ID];