Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Expression Help

Hi Experts

in my qvw i am calculating targets

i am using this expression to count the number of AREAMANAGER against REGIONMANAGER

=If(SUM(AGGR(AREAMANAGER,REGIONMANAGER,BUSINESSMANAGER,BRANCHNAME)) >= 19, 19,SUM(AGGR(AREAMANAGER,REGIONMANAGER,BUSINESSMANAGER,BRANCHNAME)))

the values yielding are correct but there is a  condition like if AREAMANAGER count exceeds 19 for aREGIONMANAGER then it writes  19 correctly

now i have to calculate the SPD targets for each AREAMANAGER, even if his branch count exceeds 19 then it should show the targets only for count of 19 branches

My expression is


=SUM(AGGR([SPD Target],REGIONMANAGER,BUSINESSMANAGER,BRANCHNAME))



Please Suggest

1 Solution

Accepted Solutions
MK_QSL
MVP
MVP

For Count

=IF(COUNT(DISTINCT AREAMANAGER_ID)>=19,19,COUNT(DISTINCT AREAMANAGER_ID))

For Target

=IF(COUNT(DISTINCT AREAMANAGER_ID)>=19,19,COUNT(DISTINCT AREAMANAGER_ID))*Only([SPD Target])

View solution in original post

4 Replies
MK_QSL
MVP
MVP

Provide sample app or sample data to work with your expected output.

sunny_talwar

Not entirely sure you are trying to achieve here. As Manish suggest, sample data as well as expected output would be helpful in providing information about your requirement.

Best,

Sunny

Not applicable
Author

HI


Please Find the Data & the Qvw attached

Capture.PNG

the target against 5561,5562,5563,5564 should be 6270


Please Suggest

MK_QSL
MVP
MVP

For Count

=IF(COUNT(DISTINCT AREAMANAGER_ID)>=19,19,COUNT(DISTINCT AREAMANAGER_ID))

For Target

=IF(COUNT(DISTINCT AREAMANAGER_ID)>=19,19,COUNT(DISTINCT AREAMANAGER_ID))*Only([SPD Target])