Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Timestamp expression

Hi All,

I have a problem with a Time Chart.

I have an database which contains data in the format below

 

CustomerProductYearMonthTurnoverQty
AZ201514001
BY201642002
CX201558003
DW201585004
EY201666005
FW201624506

I would like to calculate (MTD and YTD)  TO and Qty.

Any suggestion about

  • Base expression
  • Timestamp expression
  • Basedate expression


Thanks in advance


Fabrizio

1 Solution

Accepted Solutions
sunny_talwar

I guess the first step would be to create a date field (better than working with Year and Month fields separately). To create date, you can do like this:

Date(MakeDate(Year, Month, 1)) as Date

and then there are bunch of ways you can calculated YTD and MTD.

1) Create flags in the script - Creating A Master Calendar

2) Use set analysis to see a range of date - YTQ, QTD, MTD and WTD

3) Use As-Of Table - The As-Of Table

View solution in original post

4 Replies
sunny_talwar

I guess the first step would be to create a date field (better than working with Year and Month fields separately). To create date, you can do like this:

Date(MakeDate(Year, Month, 1)) as Date

and then there are bunch of ways you can calculated YTD and MTD.

1) Create flags in the script - Creating A Master Calendar

2) Use set analysis to see a range of date - YTQ, QTD, MTD and WTD

3) Use As-Of Table - The As-Of Table

Not applicable
Author

Store current month & year into 2 variables.

V_mnth= Month(today())

V_year= Year(today())

for current YTD= sum({<Year=V_year>}Qty)

for current MTD= sum({<Month=V_mnth>}Qty)

maxgro
MVP
MVP

I think you need a date in your data to calculate YTD and MTD (periodo starting at the beginnng of current year / month and ending at the current date).

Then you can use the first link from Sunny post and set analysis, something like

sum({$ <CurYTDFlag={1}> Qty}

Not applicable
Author

Hi All,

Many thanks for your help!

BR

Fabrizio