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: 
Not applicable

Previous month last date

Dear All,

i want to add Previous month Last day sales and want to compare from current month Last day sales.

For example today is 29-2-2016 i want to extract  31-1-2016 date as well as sales of that date.

i have two fields one for 'Date' and other is 'Sales', i hope its clear now

13 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

You can use the Function as below.

=Sum({<Date ={"$(=Monthend(Addmonths(Max(Date),-1)))"}>}Sales)

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
maxgro
MVP
MVP

sum({$ <Date={"$(=monthend(today()))"}>} Sales)

sum({$ <Date={"$(=date(monthstart(today())-1))"}>} Sales)

Not applicable
Author

both formulas giving me zero i do not know y but it is giving me zero.

Sales is my field as well as date field.here is my data if you could help me.

   

RegionDateSales
South1-Jan-1610
Central2-Jan-1611
North3-Jan-1612
South4-Jan-1613
Central5-Jan-1614
North6-Jan-1615
South7-Jan-1616
Central8-Jan-1617
North9-Jan-1618
South10-Jan-1619
Central11-Jan-1620
North12-Jan-1621
South13-Jan-1622
Central14-Jan-1623
North15-Jan-1624
South16-Jan-1625
Central17-Jan-1626
North18-Jan-1627
South19-Jan-1628
Central20-Jan-1629
North21-Jan-1630
South22-Jan-1631
Central23-Jan-1632
North24-Jan-1633
South25-Jan-1634
Central26-Jan-1635
North27-Jan-1636
South28-Jan-1637
Central29-Jan-1638
North30-Jan-1639
South31-Jan-1640
Central1-Feb-1660
North2-Feb-16150
South3-Feb-16240
Central4-Feb-16330
North5-Feb-16420
South6-Feb-16510
Central7-Feb-16600
North8-Feb-16690
South9-Feb-16780
Central10-Feb-16870
North11-Feb-16960
South12-Feb-161050
Central13-Feb-161140
North14-Feb-161230
South15-Feb-161320
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Current Month MaxDate:

Sum({<Year=, Quarter=, Month=, Date={"$(=Date(MonthEnd(Today())))"}>} Sales)

Previous Month MaxDate:

sum({<Year=, Quarter=, Month=, Date={"$(=Date(MonthEnd(Today(),-1)))"}>} Sales)

Hope this helps you.

Regards,

Jagan.

Anonymous
Not applicable
Author

Simply use :

MonthEnd(Date) to get last date of every month

tresesco
MVP
MVP

Bit simpler:

=Sum({<Date ={"$(=Monthend(Max(Date),-1))"}>}Sales)

sunny_talwar

What is your expected output?

Anonymous
Not applicable
Author

See the attachment,

Hope this will help!!

tresesco
MVP
MVP

PFA