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

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
dhananjay_capge
Partner - Contributor III
Partner - Contributor III

How Do I Get the Number of Months left in year

Test

3 Replies
jonathandienst
Partner - Champion III
Partner - Champion III

Hi

You will need a year field and month fields based on your Sales date - lets assume that they are called SalesYear and SalesMonth

LOAD ....

     Month(SalesDate) As SalesMonth,

     Year(SalesDate) As SalesYear

     ...

Now to dynamically get the maintenance cost for last year (eg in a text box):

     Sum({<SalesYear = {"$(=Max(SalesYear))"}>} Aggr((12 - SalesMonth) * Sum(Sales * 0.2) / 12, SalesMonth))

If you want it in a chart with SalesYear as a dimension:

     Sum(Aggr((12 - SalesMonth) * Sum(Sales * 0.2) / 12, SalesMonth, SalesYear))

HTH

Jonathan

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
AbhijitBansode
Specialist
Specialist

you will get number of months left in the year using below expression :

Mod(24-(Num(Month(Today()))),12)

jonathandienst
Partner - Champion III
Partner - Champion III

Simply (12 - Month(Today())) will do it

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein