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: 
Chin_IT
Contributor II
Contributor II

Aggregation calculation

I am having issues with in Qlkiview into what calculation I will need to do. 

 

=max( aggr( count([DATE]), Stock))/ sum (Stock)

This will return the values I will need, for example 0.7, or 0.65, however, I need that calculation, but to work out how to return the results that will be less than 1. 

Labels (3)
1 Solution

Accepted Solutions
sunny_talwar
MVP
MVP

May be this

Sum(Aggr(
    If(Max(Aggr(Count([DATE]), Stock))/Sum(Stock) < 1, 1, 0)
, Piece))

 

View solution in original post

18 Replies
agigliotti
MVP
MVP

could you please explain better what number are you looking for?

The Power of shining a light on the dark side of your data.
Follow me on my LinkedIn | Know Gamma Informatica at gammainformatica.it
Chin_IT
Contributor II
Contributor II
Author

It is not I am looking for a number. The calculation should count how many are less than 1.

=max( aggr( count([DATE]), Stock))/ sum (Stock)

This calculation will return different values such as 0.7, or even 10. But I want that same calculation, but with where it also calculates how many are less than 1. 

Chin_IT
Contributor II
Contributor II
Author

If you seen from the image file, there is a column where you can 0.7.

However, the column should count how many are less than 1. In that picture it should return 1 as there is only one result. If there were 10 results with 0.7, then it will return 10. If there were 5 with 1.2, then it should return 0.

sunny_talwar
MVP
MVP

May be this

Sum(Aggr(
    If(Max(Aggr(Count([DATE]), Stock))/Sum(Stock) < 1, 1, 0)
, Piece))

 

Chin_IT
Contributor II
Contributor II
Author

Sunny,

Thank you so much! I believe it is working now. 

Thanks,

Chin_IT

Chin_IT
Contributor II
Contributor II
Author

Sunny,

How will it be if I were to use the calculation below?

Count([DATE])/Sum(Stock)

 

sunny_talwar
MVP
MVP

Not sure I follow your question?

Chin_IT
Contributor II
Contributor II
Author

It is what you did for me last time, but for a different calculation 

count([DATE])/Sum(Stock)

I want to find the values that are less than 1, and it will return a 0 if false, and a 1 if true

sunny_talwar
MVP
MVP

May be this

Sum(Aggr(
    If(Count([DATE])/Sum(Stock) < 1, 1, 0)
, Piece))