Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
ettienero
Contributor
Contributor

Time periods and alternate states

Hi guys

I have a calculation that aggregates numbers in a filed and allows selection between MTD, YTD, WTD and Custom Periods. I need to use it with Alternate States as well. I've tried this:

(the field is called GGR)

Pick($(vPeriodPicker)
//MTD
,Sum({[State A]<Year= 
,Month= 
,Day= 
,Week= 
,[Week day] = 
,Date={">=$(=MonthStart(vMaxDate))<=$(vMaxDate)"}>}
GGR)
//YTD
,Sum({[State A]<Year= 
,Month=
,Day= 
,Week= 
,[Week day] = 
,Date={">=$(=YearStart(vMaxDate))<=$(vMaxDate)"}>}
GGR) 
//Custom
,Sum({[State A]<Year= 
,Month= 
,Day= 
,Week= 
,[Week day] = 
,Date={">=$(vMinDate)<=$(vMaxDate)"}>}
GGR) 
//WTD
,Sum({[State A]<Year= 
,Month= 
,Day= 
,Week= 
,[Week day] = 
,Date={">=$(=WeekStart(vMaxDate))<=$(vMaxDate)"}>}
GGR)
)

(the same calculation exist for State B)

the calculation works for every other selection i do (selecting between regions, products, etc.) except when selecting different time periods. I'll appreciate any help or guidance

Thank you

Ettiene

5 Replies
sunny_talwar

Which state do you have your variables in (vMaxDate and vMinDate)? Are those stored as Max({[StateA]} Date) or Max(Date)? If it is not stored as Max({[StateA]} Date)... it will probably be driven based on selection in inherited state

ettienero
Contributor
Contributor
Author

Thank you, that was the problem. 

sunny_talwar

So is this resolved now? or are you still seeking help?

ettienero
Contributor
Contributor
Author

It is resolved, thank you


sunny_talwar

Awesome 🙂