Skillfully use the RunningValue function to sort and set rank rankings in groups

Source: Internet
Author: User
Introduction to the outset

There are often sort requirements like this, as well as set the sort ordinal under grouping. For example, in this figure, urban city is required to sort by the Internet sales Amount totals under the province and to identify the rankings under each province.

Implementation process

Do the grouping first, then add a new column rank.

In the group Properties of the city group, its sort is sorted according to SUM aggregation Internet Sales Amount.

Use the RunningValue function in the expression of Rank in the city row.

The function of the following expression is to calculate the number of city after the stateprovince under the specified group, then the first row is 1, and the second line adds up to 2, so that the sort rank NO is achieved.

The use of the RunningValue function can be consulted: https://msdn.microsoft.com/zh-cn/library/dd255229.aspx

Returns a run aggregation of all non-Null numeric values specified by an expression in the given scope. RunningValue (expression, function, scope)

In this example, you can turn Scope into nothing, or country to see how the RunningValue changes under different scopes.

For more bi articles, see the Bi-series essay list (SSIS, SSRS, SSAS, MDX, SQL Server) If you feel this article has helped you, please help recommend it to make it easy for others to see these articles quickly in the Biwork blog recommendations Bar.

Skillfully use the RunningValue function to sort and set rank rankings in groups

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.