Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
sravankv
Partner - Contributor III
Partner - Contributor III

How to apply max function to a variable in set analysis

Hi All,

I have 2 different dates in my data set(Manufacture and Sale). Now the requirement is to create a KPI which always shows max year and month count.

for which i can write 2 expressions for each date, which works perfectly. ex:

='Manufacure Count: '&Count({<Mani_Month_Nm={"$(=max(Mani_Month_Nm))"}, Mani_Year={"$(=max(Mani_Year))"}, Mani_Month>}Item) 

='Sales Count: '&Count({<Sal_Month_Nm={"$(=max(Sal_Month_Nm))"}, Sal_Year={"$(=max(Sal_Year))"}, Sal_Month>}Item)

But, i want to avoid writing 2 expressions and make dynamic a single one.

=Count({<$(vMoM)={"$(=max($(vMoM)))"}, $(vYoY)={"$(=max($(vYoY)))"}, $(vM)=>}Item)

Here the problem is applying max function to the variable(it is not working). 

Appreciate any help(attached sample app).

Labels (3)
1 Reply
Anil_Babu_Samineni

How is the variables define?

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful