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

WTD,MTD & YTD info irrespective of filter selection

Hi, I have a KPI tiles which should show the Weekly ,Monthly & Yearly irrespective of the global filter selection Where i have used this set analysis formula in order to get the Rolled_to_Amt value. Formula: Sum({}[ROLLED_TO_AMT]) I am looking to add a default selector(Weekly ,Monthly & Yearly) control in the same set analysis. Can anyone please help?

17 Replies
Anonymous
Not applicable
Author

This is the auto generator calendar

[autoCalendar]:

  DECLARE FIELD DEFINITION Tagged ('$date')

FIELDS

  Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),

  Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),

  Month($1) AS [Month] Tagged ('$month', '$cyclic'),

  Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),

  Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),

  Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),

  Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),

  Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified'),

  If (DayNumberOfYear($1) <= DayNumberOfYear(Today()), 1, 0) AS [InYTD] ,

  Year(Today())-Year($1) AS [YearsAgo] ,

  If (DayNumberOfQuarter($1) <= DayNumberOfQuarter(Today()),1,0) AS [InQTD] ,

  4*Year(Today())+Ceil(Month(Today())/3)-4*Year($1)-Ceil(Month($1)/3) AS [QuartersAgo] ,

  Ceil(Month(Today())/3)-Ceil(Month($1)/3) AS [QuarterRelNo] ,

  If(Day($1)<=Day(Today()),1,0) AS [InMTD] ,

  12*Year(Today())+Month(Today())-12*Year($1)-Month($1) AS [MonthsAgo] ,

  Month(Today())-Month($1) AS [MonthRelNo] ,

  If(WeekDay($1)<=WeekDay(Today()),1,0) AS [InWTD] ,

  (WeekStart(Today())-WeekStart($1))/7 AS [WeeksAgo] ,

  Week(Today())-Week($1) AS [WeekRelNo] ;


DERIVE FIELDS FROM FIELDS [PROCESSED_DT] USING [autoCalendar] ;


You meant this?

YoussefBelloum
Champion
Champion

Ok, here with the calendar you have you can use the fields: Date, YearMonth for YTD MTD and WTD

Try this for the YTD:

Sum({<Date={">=$(=Yearstart(Max(Date)))<=$(=Max(Date))"} >}[ROLLED_TO_AMT])


Try this for the WTD:


Sum({<Date={">=$(=WeekStart(Max(Date))) <=$(=Date(Max(Date)))"} >}[ROLLED_TO_AMT])

Try this for the MTD:

Sum({<Date={">=$(=(MonthStart(Max(Date))))<=$(=Max(Date))"} >}[ROLLED_TO_AMT])


Anonymous
Not applicable
Author

Hi youssef,


I have tried.But its not working out


Below mentioned is the same

=Sum({<[Weekly_Rollover_Activity_Only.ROLLOVER_DESTINATION_TXT]={'RTF'},Date={">=$(=WeekStart(Max(Date))) <=$(=Date(Max(Date)))"}>}[Weekly_Rollover_Activity_Only.ROLLED_TO_AMT])/1000000

can u plz chk this let me knw?

YoussefBelloum
Champion
Champion

To go further you should send me sample data.

try to attach an excel file or a QVD with some rows of your data to take a look

Anonymous
Not applicable
Author

It's worked.I forgot to change the datefield

But it shows Till date information. But i don't want to show the incomplete week information

For example.

If i check the dashboard today it has to show till 4th March(i.e till sunday) for MTD,YTD & WTD.How to make that change?

Sorry for the trouble

YoussefBelloum
Champion
Champion

here we go:

Sum({<Date={">=$(=Yearstart(Max(Date)))<=$(=WeekEnd(Max(Date),-1))"} >}[ROLLED_TO_AMT])


Try this for the WTD:


Sum({<Date={">=$(=WeekStart(Max(Date))) <=$(=Date(WeekEnd(Max(Date),-1)))"}>}[ROLLED_TO_AMT])

Try this for the MTD:

Sum({<Date={">=$(=(MonthStart(Max(Date))))<=$(=WeekEnd(Max(Date),-1))"} >}[ROLLED_TO_AMT])

Anonymous
Not applicable
Author

Let me try this

Anonymous
Not applicable
Author

Hi Yousef

YTD and WTD is working....

But MTD is throwing wrong data....Below is my formula

=Sum({<[Weekly_Rollover_Activity_Only.ROLLOVER_DESTINATION_TXT]={'RTF'},

[PROCESSED_DT.autoCalendar.Date]={">=$(=(MonthStart(Max([PROCESSED_DT.autoCalendar.Date]))))<=$(=WeekEnd(Max([PROCESSED_DT.autoCalendar.Date]),-1))"}>}

[Weekly_Rollover_Activity_Only.ROLLED_TO_AMT])/1000000