Hello,
I need to know if it is possible to represent a graph by selecting multiple values in field Group by (Data source- Aggregation )
I was able to do it only when I have a variable in a data field with several options but failed to represent separate fields .
If I understand you correctly, you want to perform your grouping based on multiple columns. In this case, you can either add a calculated field and use that or add a bit of JavaScript.
Option 1.
- Add a new list column, select “Calculated (calculation based on other columns)” type
- Enter a formula into the formula box. This formula will determine the value of the field, for example:
=IF([field1]="a","Group 1",IF([field2]>100,"Group 2","Group 3"))
You add pretty complex formulas this way. You can check the web for more info, for example this page: http://sharepoint.rackspace.com/calculated-columns-tutorial
3. Save the field, then use in as the Group By field in Dashboard Designer.
Option 2.
- Go to Data Source -> Advanced and replace the handers.requestSuccess function with the following:
handlers.requestSuccess = function(data, logger) {
//iterating through all retrieved list entities
for (var i = 0; i < data.items.length; i++) {
//my custom example grouping logic. What I do here is assign Group value to the current entity in the iteration, based on two columns: field1 and field2
data.items[i].Group = data.items[i].field1 == "a" ? (data.items[i].field2 > 99 ? "group A" : "group B") : "group C";
//you can do anything here, for example:
/*
if (data.items[i].field1 == "a") {
if (data.items[i].field2 > 100) {
if (data.items[i].field3 == "xyz") {
data.items[i].Group = "Group 1";
}
else if (data.items[i].field3 == "abc") {
data.items[i].Group = "Group 2";
}
else {
data.items[i].Group = "Group 3";
}
}
else {
data.items[i].Group = "Group 4";
}
}
*/
//etc.
}
return true;
}
2. Click Process
3. Go to Data Source -> Aggregation and select Group By: Group.
4. Click Process, then configure your chart as normal.