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

Cannot sum a measure which implies a min() statement

Hi community,

I'm trying to sum up a measure calculated with a minimum statement. The measure and the other field are:

[PESO RC *]= {MIN({<[PRO Linea Proceso]={'3320','3340'}>}[PRO PESO RC])

[PESO LC]=[PESO LC] //field in one of the charts from the script

And then, I want to sum the following:

sum([PESO LC]-[PESO RC *])

And it gives me an error as not recognizing the measure [PESO RC *]

Please help!!!

Labels (2)
1 Solution

Accepted Solutions
Rohan
Specialist
Specialist

Hi @AidaAR ,

Is this measure created in front end as a Master Measure or something ?, If that's the case then, you will have to use aggr function to calculate nested aggregations. so something like : 

sum( aggr(max([PESO LC]),Key_field) - aggr(MIN({<[PRO Linea Proceso]={'3320','3340'}>}[PRO PESO RC]) ,Key_field))

Try it out & let me know if it works for you.

Regards,

Rohan.

 

View solution in original post

3 Replies
Rohan
Specialist
Specialist

Hi @AidaAR ,

Is this measure created in front end as a Master Measure or something ?, If that's the case then, you will have to use aggr function to calculate nested aggregations. so something like : 

sum( aggr(max([PESO LC]),Key_field) - aggr(MIN({<[PRO Linea Proceso]={'3320','3340'}>}[PRO PESO RC]) ,Key_field))

Try it out & let me know if it works for you.

Regards,

Rohan.

 

AidaAR
Contributor II
Contributor II
Author

Yes! It works! Thank you very much!

TauseefKhan
Creator III
Creator III

Hi @AidaAR,

Check this:

Sum(
Aggr(
[PESO LC] - min({<[PRO Linea Proceso]={'3320','3340'}>} [PRO PESO RC]),
[YourDimensions]
)
)