year-week can be calculated in different ways.
a) via the right click context menu/new formula column :
b) via Time Bins in Graph Builder [via DateIncrement(date, 0)]
This plots shows both values in the same graph.
On the top is: week by binning in Graph Builder, the bottom graph shows the week calculated via new formula column:
Why is "week" not defined consistently at both places ?!?
How can I make the weekly binning in Graph Builder start on a Monday ?!?
dt = New Table( "test",
Add Rows( 30 ),
Compress File When Saved( 1 ),
New Column( "date",
Format( "y/m/d", 12 ),
Formula( Date DMY( 1, 1, 2024 )+ row()*24*60*60 )
)
);
dt << New Formula Column(
Operation( Category( "Date Time" ), "Year Week" ),
Columns( :date )
);
dt << New Formula Column(
Operation( Category( "Date Time" ), "Day of Week Name" ),
Columns( :date )
);
wait(0);
dt << Data Filter(
Add Filter( columns( :Day of Week ),Where( :Day of Week == "Sunday" ) )
);
dt << Graph Builder(
Transform Column(
"Week[date]",
Format( "Format Pattern", "<YYYY></><MM></><DD>", 15 ),
Formula( Date Increment( :date, "Week", 0 ) )
),
Variables(
X( :date ),
Y( :"Week[date]"n ),
Y( :Year Week ),
Color( :Day of Week )
),
Elements( Position( 1, 1 ), Points( X, Y, Legend( 7 ) ) ),
Elements( Position( 1, 2 ), Points( X, Y, Legend( 12 ) ) ),
);