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: 
nareshthavidishetty
Creator III
Creator III

Variables

Hi,

We required an variable which would be Monthstart to till date.

Thanks..

8 Replies
tresesco
MVP
MVP

May be like:

vMTD = Sum({<Date={'>=$(=MonthStart(Max(Date))) <=$(=Date(Max(Date)))'}>}Sales)

shraddha_g
Partner - Master III
Partner - Master III

You can try this if you want to use it in set analysis.

set vVariable = '>=$(=date(max(MonthStart))) <=$(=date(today()))';

and use this variable in set analysis.

sum({<Date = {"$(vVariable)"}>}Field)

I hope it is helpful.

prabiradhikary
Partner - Contributor III
Partner - Contributor III

If you use this in expression :

Set Variable :

variable1 = MonthStart(variable2 )

variable2 = date(Max([Date]),'DD/MM/YYYY')

Expression :

Sum({<DATE={'>=$(variable1 )<=$(variable2)'}>} [MeasureName])

Anonymous
Not applicable

You can take VMTD= date(today(),'YYYY-MM').

Thanks,

nareshthavidishetty
Creator III
Creator III
Author

Hi,

Sorry i need variable starts from September to till date.

Thanks..

shraddha_g
Partner - Master III
Partner - Master III

will it always be September or Previous Month Start?

prabiradhikary
Partner - Contributor III
Partner - Contributor III

You can change your variable1 as required.

maxgro
MVP
MVP

I think you can use tresesco‌ answer, with some small changes

Sum({<Date={'>=$(=MonthStart(makedate(2016,9))) <=$(=Date(today()))'}>} Sales)

or this

Sum({<Date={'>=$(=MonthStart(addmonths(today(),-1))) <=$(=Date(today()))'}>} Sales)