Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
poluvidyasagar
Creator II
Creator II

Expression total using aggr() and SUM()

Hi,

I am trying to calculate the total number of orders who average time is less than 5 hours (300 minutes). However, it does not get reflected in expression total in straight box.

So, i have a straight table like the following: It has no dimensions but only measures:

Avg TimeNo of ordersOrders < 5 hours
188080 (need help here)

 

The column "Orders <5 hours" is incorrect. Because i do have orders with avg time less than 5 hours.

This is the other straight table with order number as dimension. In this table, the column under 5 hours gives me right values but does not give sum in the expression total.

OrderNumberTimeUnder 5 hours
 1880 (expression total)

0 (expression total) Need help here

11283651081
11283667680
11283687680
1128369119880
1129280221
112928111920
1129284221
11292851721

 

These 2 straight tables can be seen in then file attached.  have attached the qlikview file for reference.

can someone please help me on this?

Thanks,
Vidya

Labels (1)
9 Replies
tincholiver
Creator III
Creator III

you need expression time in the second graph.

I don´t know if it´s the result that you have looking for.

poluvidyasagar
Creator II
Creator II
Author

Hi,

I need two things here:

1.In the first straight table with "order number" as dimensions, i want expression total in the column "Under 5 hours"

If you see from the straight table with order number as dimensions, if you sum the column values of "under 5 hours", it should be 4 which should be expression total. ( it is not currently shown)

2. In the second straight table, i would like to have the same value in the column " under 5 hours" but with no dimension. So, basically aggregating it by dimension.

Let me know if you understood my questions.

Thanks,

Vidya

 

tincholiver
Creator III
Creator III

Hey Vidja, 

I could only solve the first case of the sum of the columns but not the other.
the problem is that the aggr function to get the calculation to remove the dimension loses meaning, then you have to modify the expression.
Can you explain how you get the hours of the orders that take more than one day? and how do you drive on weekends?

Sin título.png

do this in the expression of the graph and you will have the sum of the values

Sin título2.png

tincholiver
Creator III
Creator III

Vidja, 

can solve what you wanted even though I made some modifications in the script to be able to solve it more easily.
I do not know if it will serve you as I did but the result is the same
tell me if it served you
regards.

Under 5.png

veidlburkhard
Creator III
Creator III

Hi Poluvidyasagar,

 

for your second question the answer is

Sum(Aggr(Only(If(Time/60 <= 5, 1, 0)), OrderNumber))

 

Happy Qliking

Burkhard

poluvidyasagar
Creator II
Creator II
Author

Hi Veidlburkhard,

This expression does not give me the results i need. It still gives me zero.

Screenshot.PNG

Thanks,
Vidya

poluvidyasagar
Creator II
Creator II
Author

Hi Tincholiver,

I know this feature using "Sum" in total mode. However, i would this to be calculated using total expression.

Because what works for question 1 should work for question 2.

You have mentioned that " aggr function to get the calculation to remove the dimension loses meaning". Can you elaborate on this?

Thanks,
Vidya

poluvidyasagar
Creator II
Creator II
Author

Hi Tincholiver,

The data provided in the problem is simple. But, I have complex data which needs lot of set analysis. I have not provided those details here.

I am sure we can solve the problem the way u did but i would like this to be done on the chart script.

Thanks,
Vidya
tincholiver
Creator III
Creator III

I was referring to that in the Time expression, the number of orders will result in 4 having dimension to OrderNumber, if you remove that dimension the result is 1880, then the expression = if ([Time] <300,1,0) is working well only that it does not find any value that fulfills that condition that's why it gives zero