Displaying the Top N Dynamically

  • Last update:  2023-06-26
  • Overview

    Effect

    After ranking the sales volume, you can filter out the top 30% of stores by sales volume.

    When the number of stores is 20, the top six are filtered out.

    When the number of stores is 30, the top nine are filtered out.

    Implementation Method

    First rank the sales volume of each store, then filter out the needed stores.

    Example

    This example uses Store Sales Statistics in Public Data > Department Data > Sales.

    Create a subject and add data.

    Adding Calculation Indicators

    Calculating the Ranking of Each Store

    1. Calculate Sales Volume of each store.

    iconNote:
    Fields in the formula box need to be selected from the left area and cannot be manually entered.

    2. Rank stores by Sales Volume.

    FormulaDescription

    DEF(COUNTD_AGG(Shop   Number)+1,[Shop Number],[Sales Volume of Each Store>EARLIER(Sales Volume   of Each Store)])

    • Specified dimension: Shop Number

    • Aggregated metric calculation: COUNTD_AGG(Shop Number)+1

    • Filter condition: Sales Volume of Each Store > EARLIER(Sales

      Volume of Each Store), which means filtering out all stores whose sales volume are greater than that of the current store.

    Calculate the ranking by adding 1 for as many times as the number of 

    stores whose sales volume is greater than that of the current store.

    Calculating the Total Number of Stores

    Add a calculation field Total Number of Stores by using the formula DEF to calculate the total number of stores.

    Creating a Table Component

    1. Drag Shop Number into Dimensions, and Sales Volume, Ranking, and Total Number of Stores into Indicators.

    Select Group Table as Chart Type.

    2. Move the cursor over the Shop Number field and click  > Filter.

    Filtering out the Top 30% of Stores by Sales Volume

    Set the filter condition: Ranking(Sum)<=0.3*Total Number of Stores(Sum)

    iconNote:
    Fields in the formula box need to be selected from the left area and cannot be manually entered.

    The top 30% of 30 stores are the top nine ones in the Sales Volume ranking.

    The filtered effect is shown in the following figure.

    Adding a Text Filter Component

    1. Go to the dashboard editing interface and drag the just created component into the dashboard.

    2. Add a Text Drop-down Filter Component.

    Select Shop Number under Store Sales Statistics and drag it to the field column.

    Filter 20 stores in Text Drop-Down, and the ranking shows the top six.

    Demonstration

    See section "Effect".

    Notes

    Filtering out the Top 50% of Stores by Sales Volume

    The ROUND function returns the nearest integer after calculation, and the formula is Ranking(Sum)<=ROUND(Total Number of Stores(Sum)*0.5,0).

    The filter condition is shown in the following figure.

    iconNote:
    Fields in the formula box need to be selected from the left area and cannot be manually entered.

    The system automatically filters out the top 50% of stores by Sales Volume in the preview area, and the filtered effect is shown in the following figure.

    附件列表


    主题: Advanced Data Analysis
    • Helpful
    • Not helpful
    • Only read

    滑鼠選中內容,快速回饋問題

    滑鼠選中存在疑惑的內容,即可快速回饋問題,我們將會跟進處理。

    不再提示

    10s後關閉

    Get
    Help
    Online Support
    Professional technical support is provided to quickly help you solve problems.
    Online support is available from 9:00-12:00 and 13:30-17:30 on weekdays.
    Page Feedback
    You can provide suggestions and feedback for the current web page.
    Pre-Sales Consultation
    Business Consultation
    Business: international@fanruan.com
    Support: support@fanruan.com
    Page Feedback
    *Problem Type
    Cannot be empty
    Problem Description
    0/1000
    Cannot be empty

    Submitted successfully

    Network busy