Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
shanky1907
Creator II
Creator 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
sunny_talwar

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?

View solution in original post

4 Replies
sunny_talwar

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?

View solution in original post

shanky1907
Creator II
Creator II
Author

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
Creator II
Creator II
Author

Hello Sunny,

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

sunny_talwar

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