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.

    Attachment List


    Theme: 高度なデータ分析学習
    前の記事
    次の記事
    • いいね
    • 良くない
    • 閲覧しただけ

    フィードバック

    鼠标选中内容,快速反馈问题

    鼠标选中存在疑惑的内容,即可快速反馈问题,我们将会跟进处理。

    不再提示

    9s后关闭

    反馈已提交

    网络繁忙