Hi Pmroz,
Script with JSL,
Thank you,
// → Data Table( "GSB" )
Local( {obj},
obj = Data Table( "GSB" ) <<
Graph Builder(
Size( 604, 659 ),
Variables(
X(
Transform Column(
"Month Year[Date Measured]",
Ordinal,
Format( "m/y", 23 ),
Formula(
Date DMY(
1,
Month( :Date Measured ),
Year( :Date Measured )
)
)
)
),
Overlay( GSB Validation )
),
Elements(
Bar(
X,
Legend( 11 ),
Bar Style( "Stacked" ),
Summary Statistic( "% of Factor" ),
Label( "Label by Value" )
)
),
Local Data Filter(
Add Filter(
columns(
:"Inferred Value (Yes/No)"n,
Transform Column(
"Month Year[Date Measured]",
Ordinal,
Format( "m/y", 23 ),
Formula(
Date DMY(
1,
Month( :Date Measured ),
Year( :Date Measured )
)
)
)
),
Where( :"Inferred Value (Yes/No)"n == "Yes" ),
Where(
Transform Column(
"Month Year[Date Measured]",
Ordinal,
Format( "m/y", 23 ),
Formula(
Date DMY(
1,
Month( :Date Measured ),
Year( :Date Measured )
)
)
) == {3755376000, 3758054400, 3760473600, 3763152000, 3765744000,
3768422400, 3771014400, 3773692800, 3776371200, 3778963200,
3781641600}
),
Display(
Transform Column(
"Month Year[Date Measured]",
Ordinal,
Format( "m/y", 23 ),
Formula(
Date DMY(
1,
Month( :Date Measured ),
Year( :Date Measured )
)
)
),
N Items( 15 )
)
)
),
SendToReport(
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( "Monthly GSB Validation (%)" )}
),
Dispatch( {}, "Y title", TextEditBox, {Set Text( "%" )} ),
Dispatch( {}, "Where((Inferred Value (Yes", TextBox, {Hide( 1 )} )
)
);
obj << Save Script to Data Table(
"Monthly GSB Validation (%)", <<Replace( 1 ), <<Prompt( 0 )
);
obj << Close Window;
);
Graph Builder(
Transform Column(
"Year Week[Date Measured]",
Character,
Formula(
Local(
{w = Week Of Year( :Date Measured, 3 ), y = Year( :Date Measured ),
m = Month( :Date Measured )},
If( Is Missing( :Date Measured ),
"",
Char( If( m / w >= 12, y + 1, w / m >= 52, y - 1, y ) ) ||
If( w >= 10, "W", "W0" ) || Char( w )
)
)
)
),
Size( 570, 619 ),
Variables( X( :"Year Week[Date Measured]"n ), Overlay( :Best product ) ),
Elements(
Bar(
X,
Legend( 2 ),
Bar Style( "Stacked" ),
Summary Statistic( "% of Factor" ),
Label( "Label by Value" )
)
),
Local Data Filter(
Add Filter(
columns( :"Year Week[Date Measured]"n ),
Where(
:"Year Week[Date Measured]"n == {"2023W48", "2023W49", "2023W50",
"2023W51", "2023W52", "2024W01", "2024W02", "2024W03", "2024W04",
"2024W05", "2024W06", "2024W07", "2024W08"}
),
Display(
:"Year Week[Date Measured]"n,
N Items( 15 ),
Find( Set Text( "" ) )
)
)
),
SendToReport(
Dispatch(
{},
"Where(Year Week[Date Measured] = 2023W48, 2023W49, 2023W50, 2023W51, 2023W52, 2024W01, 2024W02, 2024W03, 2024W04, 2024W05, 2024W06, 2024W07, 2024W08)",
TextBox,
{Hide( 1 )}
)
)
);