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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
RayWu
Contributor III
Contributor III

How to insert the expression "Sum" into expression "Count"

I want to count the number of vendors that meet the following conditions.

1. Recent 1 year. 2. The total Amount > = $(V1) < = $(V2)

I don't know how to write the expression "SUM" into the expression "Count".

sum({<T3.DateC= {">=$(=AddMonths(Max(T3.DateC), -11))"}>}[T3.Amount]) >=$(V1)<=$(V2)

Count({< ?????? >}distinct[T3.VendorID])

I tried the following methods, but the results were incorrect because Amount was not aggregated.

Count({<
[T3.Amount]={">=$(V1)<=$(V2)"},
T3.DateC= {">=$(=AddMonths(Max(T3.DateC), -11))"}
>}distinct[T3.VendorID])

2 Replies
sunny_talwar

Not sure I understand what you are trying to do.... would you be able to share a sample and provide the output you are hoping to see from it?

sagarjagga
Creator
Creator

Count(distinct Aggr(if(sum({<T3.DateC= {">=$(=AddMonths(Max(T3.DateC), -11))"}>}[T3.Amount]) >=$(V1)

and sum({<T3.DateC= {">=$(=AddMonths(Max(T3.DateC), -11))"}>}[T3.Amount]) <=$(V2) ,[T3.VendorID])

[T3.VendorID]))