# Qlik Sense App Development

New Contributor III

## FTD,MTD,YTD (Qlik Sense)

hi,

the date field is FKDAT(taking from sap) and i have linked this with normal Calendar Date as follows

CalendarMaster:

Date(FKDAT) AS FKDAT,

Floor(Date(FKDAT)) AS DateNum,

Year(FKDAT) AS Year,

'Q' & Ceil(Month(FKDAT) / 3) AS Quarter,

Month(FKDAT) As Month,

Day(FKDAT) As Day,

Week(FKDAT) As Week

RESIDENT SAP_Data;

how to find FTD,MTD,YTD for (Sum(Sales)) using set expression .

FTD-  for the day-1

MTD- for the prevoius month

(if current year is January 2017 the it should be show sum of December 2016).

i have to display FTD,MTD,YTD in Table

1 Solution

Accepted Solutions
Valued Contributor III

## Re: FTD,MTD,YTD (Qlik Sense)

Hi Satish

not sure what you want is really called MTD or YTD or more like previous month sale or previous day sale

but the expressions will look more or less like this, Please check your date format

set vMaxDate = =Date(max(FKDAT), 'DD-MM-YYYY');

set vPrevDate = =Date(max(FKDAT)-1, 'DD-MM-YYYY');

set vPrevMonth = =Date(MonthStart(Max(FKDAT), -1), 'MMM')

expressions

Sum({<[FKDAT]={'\$(vMaxDate)'},Year,Month>}Sales)

SUM({<Month={'\$(vPrevMonth)',Year>}Sales)

Valued Contributor III

## Re: FTD,MTD,YTD (Qlik Sense)

Hi Satish

not sure what you want is really called MTD or YTD or more like previous month sale or previous day sale

but the expressions will look more or less like this, Please check your date format

set vMaxDate = =Date(max(FKDAT), 'DD-MM-YYYY');

set vPrevDate = =Date(max(FKDAT)-1, 'DD-MM-YYYY');

set vPrevMonth = =Date(MonthStart(Max(FKDAT), -1), 'MMM')

expressions

Sum({<[FKDAT]={'\$(vMaxDate)'},Year,Month>}Sales)

SUM({<Month={'\$(vPrevMonth)',Year>}Sales)