Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
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 (2)
1 Solution

Accepted Solutions
sunny_talwar

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
Partner - Champion
Partner - Champion

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

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

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

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

May be this

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