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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to in show default month data, and able to choose/show other month, in Set analysis

Hello,   Please help me.

for example, I have a pie chart,  there are (2) expressions, one is $(vPercentage), other is 1-$(vPercentage),

vPercentage = Count({$<[Is purchased]={'Yes'}, Month={'Jul'}>}customerID)/Count({$<Month={'Jul'}>}customerID)

How can I show the pie chart by default for July, and also able to choose other month(s) data to show accordingly?   Thank you. 

Your kind help is appreciated. 

1 Solution

Accepted Solutions
prabiradhikary
Partner - Contributor III
Partner - Contributor III

you can use a variable :

vMaxMonth= Max(Month)

vPercentage = Count({$<[Is purchased]={'Yes'}, Month={'$(vMaxMonth)'}>}customerID)/Count({$<Month={'$(vMaxMonth)'}>}customerID)


Now you can select your month as max month.


Also if you want default month you can use Sheet Event Trigger where you can put a month as max month


Sheet Event Trigger


Sheet Properties -> Triggers -> OnActive Sheet -> Add Action -> External -> Set Variable ->


Variable=vMaxMonth

Value = Jul



View solution in original post

4 Replies
tresesco
MVP
MVP

One way could be putting a condition - when nothing is selected show 'Jul' data else as per selection. try like:

vPercentage = If( GetSelectedCount(Month), Count({$<[Is purchased]={'Yes'}>}customerID)/Count(customerID),

Count({$<[Is purchased]={'Yes'}, Month={'Jul'}>}customerID)/Count({$<Month={'Jul'}>}customerID)

)


Edit: corrected a bracket

prabiradhikary
Partner - Contributor III
Partner - Contributor III

you can use a variable :

vMaxMonth= Max(Month)

vPercentage = Count({$<[Is purchased]={'Yes'}, Month={'$(vMaxMonth)'}>}customerID)/Count({$<Month={'$(vMaxMonth)'}>}customerID)


Now you can select your month as max month.


Also if you want default month you can use Sheet Event Trigger where you can put a month as max month


Sheet Event Trigger


Sheet Properties -> Triggers -> OnActive Sheet -> Add Action -> External -> Set Variable ->


Variable=vMaxMonth

Value = Jul



sunny_talwar

Is Jul your max month? May be you can use Month(Date#(Max(Month))) instead of hard coding the month

Count({$<[Is purchased] = {'Yes'}, Month = {"$(=Month(Date#(Max(Month), 'M')))"}>} customerID)/Count({$<Month ={"$(=Month(Date#(Max(Month), 'M')))"}>} customerID)

Not applicable
Author

Thank you all for all reply!