Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
ganadara
Contributor
Contributor

yesterday set analysis in table

hi, everyone

i'm having in problems to calculate the operating time of yesterday and tomorrow

i have three fields (YYYYMMDD, operating_time, event) and I'd like to make the following table.

bf_operating_timeYYYYMMDDaf_operating_time
operating time of 2018-12-262018-12-27operating time of 2018-12-28
operating time of 2019-04-082019-04-09operating time of 2019-04-10
operating time of 2019-04-292019-04-30operating time of 2019-05-01
.........

 

'event' field means whether or not an event occuered (0:not occured, 1: occured)

 

'YYYYMMDD' dimension

=aggr(only({<event={'1'}>} yyyymmdd, yyyymmdd)

 

what i want is bf_operating_time formula and af_operating_time formula

= sum( [set analysis] operating_time)

 

how can i make [set analysis] part? is it possible?

please help, thank you

 

1 Solution

Accepted Solutions
JordyWegman
Partner - Master
Partner - Master

Hi Ganadara,

Try this with making two new columns:

//Yesterday
Date(Floor(Date#(YYYYMMDD,'YYYY-MM-DD')-1,'YYYY-MM-DD')

//Tomorrow
Date(Floor(Date#(YYYYMMDD,'YYYY-MM-DD')+1,'YYYY-MM-DD')

 

The Date# is for interpreting your current date, floor for making a numeric value and then subtract/plus 1 and create the new date format.

Jordy

Climber

Work smarter, not harder

View solution in original post

1 Reply
JordyWegman
Partner - Master
Partner - Master

Hi Ganadara,

Try this with making two new columns:

//Yesterday
Date(Floor(Date#(YYYYMMDD,'YYYY-MM-DD')-1,'YYYY-MM-DD')

//Tomorrow
Date(Floor(Date#(YYYYMMDD,'YYYY-MM-DD')+1,'YYYY-MM-DD')

 

The Date# is for interpreting your current date, floor for making a numeric value and then subtract/plus 1 and create the new date format.

Jordy

Climber

Work smarter, not harder