Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Independent validation for trusted, AI-ready data integration. See why IDC named Qlik a Leader: Read the Excerpt!
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnevitt
Creator
Creator

Expression help

Hi,

I have the following expression and I would appreciate some help with adding a DISTINCT trade_num to the expression:

sum(total <udf_code> fabs(pos_lots))

Thanks,

Daniel

1 Solution

Accepted Solutions
sunny_talwar

and all of these should work also (I think)

Sum(TOTAL <udf_code> Aggr(Avg(fabs(pos_lots)), trade_num))

Sum(TOTAL <udf_code> Aggr(Only(fabs(pos_lots)), trade_num))

I am assuming that each trade_num will have one and only one pos_lots value. If this is not true, then we would need to know which value of pos_lots need to be picked for each trade_num

View solution in original post

9 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

Can you tell us what this expression does and how it is related to Trade_num

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
danielnevitt
Creator
Creator
Author

Hi,

The expression absolute sums the total position lots by udf code.

Trade numbers make up the total position lots and I only want to sum where trade_num is distinct.

Thanks,

Daniel

sunny_talwar

Also, if you can provide some information about the chart where it is getting used and what all are the dimensions?

danielnevitt
Creator
Creator
Author

Hi,

It a column in a straight table.  I am trying to product the absolute pos_lots where trade_num is distinct when there are multiple rows on a table (for example different trader IDs).

Regards,

Daniel

sunny_talwar

So essentially sum the expression only when there is a single trade_num. If there are more than one instance of the same trade_num you don't want to sum them in your expression?

danielnevitt
Creator
Creator
Author

If there is more than one of the same trade_num, I just want to sum it once.

Hope that makes sense.

Thanks

sunny_talwar

May be this:

Sum(TOTAL <udf_code> Aggr(Sum(DISTINCT fabs(pos_lots)), trade_num))

sunny_talwar

and all of these should work also (I think)

Sum(TOTAL <udf_code> Aggr(Avg(fabs(pos_lots)), trade_num))

Sum(TOTAL <udf_code> Aggr(Only(fabs(pos_lots)), trade_num))

I am assuming that each trade_num will have one and only one pos_lots value. If this is not true, then we would need to know which value of pos_lots need to be picked for each trade_num

danielnevitt
Creator
Creator
Author

Thanks for your help