Skip to main content

Notifications

Dynamics 365 Community / Blogs / DaxGeek / Sorting Options By Group By

Sorting Options By Group By

Use the group by clause to group selected records by field. The following
example shows how to display the number of sales orders by customer group
from the Sales table.



1
2
3
4
5
6
7
8
SalesTable salesTable;
while select count(recId) from salesTable group by
CustGroup
{
print salesTable.CustGroup,"
",int642Str(salesTable.RecId);
}
pause;

The output would be a list of customer groups with the total number of sales
orders that exist for customers in that group. The count() function counts the total
number of records and places the result in the field specified in the brackets.


Best Regards,
Hossein Karimi

Comments

*This post is locked for comments