I suggest that you create a new data table that just has the customers that are in the top 10. The script below generates the subset and then plots the data.
names default to here(1);
dt=current data table();
dtSum == dt << Summary(
Group( :Customer ),
Sum( :Total Dollars Ordered ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" )
);
dtSum << sort( by(:Total Dollars Ordered), order(descending),replace table(1));
dtSum << select where(Row()>10);
dtSum << delete rows;
dtFinal = dt<< Join(
With( dtSum ),
By Matching Columns( :Customer = :Customer ),
Drop multiples( 0, 0 ),
Include Nonmatches( 0, 0 ),
Preserve main table order( 1 )
);
dtFinal << Graph Builder(
Size( 905, 603 ),
Variables(
X( :Total Dollars Ordered ),
Y(
:Customer,
Order By( :Total Dollars Ordered, Ascending, Order Statistic( "Sum" ) )
),
Overlay( :Sales Organization Code )
),
Elements(
Bar( X, Y, Legend( 4 ), Bar Style( "Stacked" ), Summary Statistic( "Sum" ) )
),
SendToReport(
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( "Total Dollars Ordered by Customer" )}
)
)
);
I did not have a copy of your data, so I have not completly tested the script, but I think it should work.
You could also modify the script to create the order number of the summary table, and then join that back into the original data table, and use that in a local data filter to allow for selection on the order.
Here is a script that is an approximation of how to create the chart using a local data filter
names default to here(1);
dt=current data table();
dtSum == dt << Summary(
Group( :Customer ),
Sum( :Total Dollars Ordered ),
Freq( "None" ),
Weight( "None" ),
statistics column name format( "column" ),
Link to original data table( 0 )
);
dtSum << sort( by(:Total Dollars Ordered), order(descending),replace table(1));
dtSum << New Column("Rank", formula(Row()));
dtSum:Rank << delete property("formula");
dtSum << delete columns({"Total Dollars Ordered", "N Rows"})
dt<< Update(
With( dtSum ) ,
Match Columns( :Customer == :Customer )
);
dt << Graph Builder(
Size( 905, 603 ),
Variables(
X( :Total Dollars Ordered ),
Y(
:Customer,
Order By( :Total Dollars Ordered, Ascending, Order Statistic( "Sum" ) )
),
Overlay( :Sales Organization Code )
),
Elements(
Bar( X, Y, Legend( 4 ), Bar Style( "Stacked" ), Summary Statistic( "Sum" ) )
),
SendToReport(
Dispatch(
{},
"graph title",
TextEditBox,
{Set Text( "Total Dollars Ordered by Customer" )}
)
),
Local Data Filter(
Add Filter( columns( :Rank ), Where( :Rank >= 1 & :Rank <= 11 ) )
);
Jim