@@ -80,6 +80,13 @@ cubes:
8080 time_shift:
8181 - name: one_year
8282
83+ - name: count_shifted_y_named_common_interval
84+ type: number
85+ multi_stage: true
86+ sql: "{count}"
87+ time_shift:
88+ - name: one_year_common_interval
89+
8390 - name: count_shifted_y1d_named
8491 type: number
8592 multi_stage: true
@@ -261,6 +268,10 @@ cubes:
261268 - name: one_year
262269 sql: "{CUBE}.retail_date_prev_year"
263270
271+ - name: one_year_common_interval
272+ interval: 1 year
273+ type: prior
274+
264275 - name: one_year_and_one_day
265276 sql: "({CUBE}.retail_date_prev_year + interval '1 day')"
266277
@@ -305,6 +316,10 @@ cubes:
305316 - name: one_year
306317 sql: "{CUBE}.retail_date_prev_year"
307318
319+ - name: one_year_common_interval
320+ interval: 1 year
321+ type: prior
322+
308323 - name: one_year_and_one_day
309324 sql: "({CUBE}.retail_date_prev_year + interval '1 day')"
310325
@@ -736,6 +751,22 @@ cubes:
736751 custom_calendar__retail_date_year : '2025-02-02T00:00:00.000Z' ,
737752 } ,
738753 ] ) ) ;
754+
755+ it ( 'Count shifted by year (custom named shift with common interval + custom granularity)' , async ( ) => runQueryTest ( {
756+ measures : [ 'calendar_orders.count' , 'calendar_orders.count_shifted_y_named_common_interval' ] ,
757+ timeDimensions : [ {
758+ dimension : 'custom_calendar.retail_date' ,
759+ granularity : 'year' ,
760+ dateRange : [ '2025-02-02' , '2026-02-01' ]
761+ } ] ,
762+ order : [ { id : 'custom_calendar.retail_date' } ]
763+ } , [
764+ {
765+ calendar_orders__count : '37' ,
766+ calendar_orders__count_shifted_y_named_common_interval : '39' ,
767+ custom_calendar__retail_date_year : '2025-02-02T00:00:00.000Z' ,
768+ } ,
769+ ] ) ) ;
739770 } ) ;
740771
741772 describe ( 'PK dimension time-shifts' , ( ) => {
@@ -889,6 +920,22 @@ cubes:
889920 custom_calendar__date_val_year : '2025-02-02T00:00:00.000Z' ,
890921 } ,
891922 ] ) ) ;
923+
924+ it . skip ( 'Count shifted by year (custom named shift with common interval + custom granularity)' , async ( ) => runQueryTest ( {
925+ measures : [ 'calendar_orders.count' , 'calendar_orders.count_shifted_y_named_common_interval' ] ,
926+ timeDimensions : [ {
927+ dimension : 'custom_calendar.date_val' ,
928+ granularity : 'year' ,
929+ dateRange : [ '2025-02-02' , '2026-02-01' ]
930+ } ] ,
931+ order : [ { id : 'custom_calendar.date_val' } ]
932+ } , [
933+ {
934+ calendar_orders__count : '37' ,
935+ calendar_orders__count_shifted_y_named_common_interval : '39' ,
936+ custom_calendar__retail_date_year : '2025-02-02T00:00:00.000Z' ,
937+ } ,
938+ ] ) ) ;
892939 } ) ;
893940 } ) ;
894941} ) ;
0 commit comments