Skip to main content

Scenario - We have 2 sheets - Dashboard and Detailed

In detailed sheet we have an OLAP table (for example) wherein we have company codes as dimension and count of documents as KPI.

Question - Now, we want to automate dashboard with a TEXT COMPONENT which only shows me top 3 company code names basis count of volume (in descending order) in the OLAP table in detailed sheet.

For Example - If we have 10 rows in OLAP table having 2 columns showing me Co. Code 1, Co. Code 2....Co. Code 10 and there is a value against each co. code.

In Dashboard under TEXT component (TOP 3 least performers) - it shows me only those 3 co. codes based on OLAP table...it can be Co. Code 5, Co. Code 7 and Co. Code 10.

 

Any guidance here will be really helpful.

 

thanks in advance.

Hi Ankur,

 

You can solve this by using nested PU aggregations, here's an example PQL for TOP 1, 2, 3:

 

TOP 1:

 

MAX(

  CASE WHEN 

  PU_COUNT(

    DOMAIN_TABLE(Company Code field)

    ,"CASES"."CASE_KEY"

  ) =

  PU_MAX(

    CONSTANT()

    ,PU_COUNT(

      DOMAIN_TABLE(Company Code field)

      ,"CASES"."CASE_KEY"

    )

  ) 

  THEN Company Code field

  ELSE NULL

  END

)

 

TOP2:

 

MAX(

  CASE WHEN 

  PU_COUNT(

    DOMAIN_TABLE(Company Code field)

    ,"CASES"."CASE_KEY"

  ) =

  PU_MAX(

    CONSTANT()

    ,PU_COUNT(

      DOMAIN_TABLE(Company Code field)

      ,"CASES"."CASE_KEY"

    )

    ,PU_COUNT(

      DOMAIN_TABLE(Company Code field)

      ,"CASES"."CASE_KEY"

    ) <

    PU_MAX(

      CONSTANT()

      ,PU_COUNT(

      DOMAIN_TABLE(Company Code field)

      ,"CASES"."CASE_KEY"

      )

    )

  ) 

  THEN Company Code field

  ELSE NULL

  END

)

 

TOP 3

 

MAX(

  CASE WHEN 

  PU_COUNT(

    DOMAIN_TABLE(Company Code field)

    ,"CASES"."CASE_KEY"

  ) =

   

  PU_MAX(

    CONSTANT()

    ,PU_COUNT(

      DOMAIN_TABLE(Company Code field)

      ,"CASES"."CASE_KEY"

    )

    ,PU_COUNT(

      DOMAIN_TABLE(Company Code field)

      ,"CASES"."CASE_KEY"

    ) <

    PU_MAX(

      CONSTANT()

      ,PU_COUNT(

        DOMAIN_TABLE(Company Code field)

        ,"CASES"."CASE_KEY"

      )

      ,PU_COUNT(

        DOMAIN_TABLE(Company Code field)

        ,"CASES"."CASE_KEY"

      ) <

      PU_MAX(

        CONSTANT()

        ,PU_COUNT(

        DOMAIN_TABLE(Company Code field)

        ,"CASES"."CASE_KEY"

        )

      )

    )

  )

  THEN Company Code field

  ELSE NULL

  END

)

 

One thing to note - this method utilizes PU aggregations, so it will ignore the filters you apply using the front end.

 

Let me know if that helped, please upvote if it solved your issue.

Thanks!

 

Eugene


Reply