Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

shanky1907
Contributor II

Conditional calculation in text box

Hello All,

 

I have one query. I need to show the Top contributor in a text box.

Condition is: The number of sale of the vendor should be more then or equal to 2. So Top contributor should only be calculated amongst only those Vendors which has at least 2 Sales done.

The condition is very easy:

If(Aggr(Count Distinct SaleID), Vendor) >=2, Vendor).

The above condition is working fine in the chart as i have Vendor as a dimension and kept the calculated dimension as the above condition.

But when i use the same condition in the text box. It doesnt work well and consider all Vendors inclusing those which have single saleID also to calculate the average sale. [If(Aggr(Count (Distinct SaleID), Vendor) >=2,

num(Max(Aggr((Sum(Sales)/count(
distinct SaleID)), Vendor)),'##.#'))]

Can anyone suggest what wrong i am doing here or a better way to achieve the requirement.

Thanks a lot in advance.

Labels (2)
1 Solution

Accepted Solutions

Re: Conditional calculation in text box

May be this

FirstSortedValue({<Vendor = {"=Count(DISTINCT SaleID) >= 2"}>}Vendor, -Aggr(Sum(Sales), Vendor))

Here we are looking for the vendor name with the maximum sales with at least two sales. Is this what you wanted?

4 Replies

Re: Conditional calculation in text box

May be this

FirstSortedValue({<Vendor = {"=Count(DISTINCT SaleID) >= 2"}>}Vendor, -Aggr(Sum(Sales), Vendor))

Here we are looking for the vendor name with the maximum sales with at least two sales. Is this what you wanted?

shanky1907
Contributor II

Re: Conditional calculation in text box

Excellent.
That is what i was missing somewhere in the syntax. Thank you Sunny as always. Let me check if the same goes good everywhere.
shanky1907
Contributor II

Re: Conditional calculation in text box

Hello Sunny,

Is it possible to use one of the variable at the place of Vendor in the set analysis.

Highlighted

Re: Conditional calculation in text box

I don't know the context, but give it a shot....