I have a scorecard that displays a metric called Cash MTD % (see screenshot below) for each operation (Org). The metric is built using formula visualization. Currently, the scorecard is being sort by dimension Facility (Org). Is it possible to sort the scorecard by Cash MTD % metric (see red arrows and screenshot 2). Again, Cash MTD % metric is a formula visualization with the following formula: $dataLabel2.Cash Collected BusDay MTD.CashCollected$/$dataLabel8.Revenue Prior Month.RevenueLag-1$
Sort Scorecard by formula visualization metric
Hello @nathan.nguyen,
If you would like to sort a specific visualisation by a measure this is possible.
I am using the script from below in order to sort a table by different measures. From two dropDown lists I am taking the measure and the sorting order(ascending, descending, unspecified).
var view = this.parentView;
var requestOverrides = new dundas.data.RequestOverrides();
var measureSortingPolicy =
new dundas.data.MeasureSorting();
var measureSortingByHierarchyLevel =
new dundas.data.MeasureSortingByHierarchyLevel(
{
direction: dropDownList4.value,
hierarchyUniqueName: ‘x’,
hierarchyLevelUniqueName: ‘x’
});
measureSortingPolicy.directions.push(measureSortingByHierarchyLevel);
var requestMeasureOverrides = new dundas.data.RequestMeasureOverrides(
{
uniqueName: dropDownList3.value,
sortPolicy: measureSortingPolicy
});
requestOverrides.measureOverrides.push(requestMeasureOverrides);
var metricSetBindingOverride =
view.control.overrides.getMetricSetBindingOverrideById(table27.id, table27.metricSetBindings[0].id);
if(metricSetBindingOverride)
{
metricSetBindingOverride.requestOverrides = requestOverrides;
}
else
{
view.control.overrides.metricSetBindingOverrides.push(
{
adapterId: table27.id,
metricSetBindingId: table27.metricSetBindings[0].id,
requestOverrides: requestOverrides
}
);
}
var dataLoadPromise = table27.loadData();
Hi Nathan,
Typically with a scorecard/small multiple/report you can control the sort order by adjusting the sort order of the Group Metric Set. As long as you have your calculation in the group metric set and sort from there, you should be good.
Click on the highlighted section to view the group metric set.
I would like to sort the Scorecard by Cash MTD % metric, which is built using formula visualization. Because of that, i can’t add it to the Group Metric Set to sort.
Thanks! The measures you referenced are part of a metric set that the table uses, correct? In my case, the measure I need to sort by is created using formula visualization, which created a separate visualization along with many others I already have in the scorecard. In turn I need to sort the entire scorecard by this metric. Not sure if your example script can accomplish this.
Hi Nathan,
Can you create a formula like I have done below on your group metric set? If you can bake it into the group metric set, you can totally sort on it. Otherwise, perhaps you can do your calculation in a data cube in advance of the scorecard?
Hello @nathan.nguyen,
You are right. The script presented by me is using a measure which is part of the respective metric set. I will test to see if I can update the script following your case.