Skip to main content
I have the following PQL Code and it is working.

TABLE (COUNT( "AP_BSEG"."ZTERM" ),"AP_BSEG"."ZTERM");

How am i able to get the Max value from it? So overall the expression should give me the name of the most frequent value in this table column

Hello Philip,

 

I had not even know there is an expression as 'Table' (:

 

Please try ; PU_MAX ( target_table, source_table.column n, filter_expression] ).

 

But PU functions cant have same tables as source and target tables.

so you need also use domain_table.


So filter_expression would be count?


There are a few ways you can get the MAX value of the payment terms:

 

1-standard aggregation

MAX("AP_BSEG"."ZTERM")

 

2-PU aggregation

PU_MAX(

CONSTANT()

,"AP_BSEG"."ZTERM"

)

 

The answer to second question is a bit different

So overall the expression should give me the name of the most frequent value in this table column

 

To answer that I would create an OLAP with the following parameters

 

Dimension - "AP_BSEG"."ZTERM"

KPI - COUNT_TABLE("AP_BSEG")

 

This will produce a table with all available payment terms and number of invoice lines per each

 

IF you want this in a single KPI component, try this:

 

COUNT(

CASE WHEN "AP_BSEG"."ZTERM" = PU_MAX(CONSTANT() ,"AP_BSEG"."ZTERM")

THEN 1

ELSE NULL

END

)

 

This expression will return the number of record counts in AP_BSEG where the payment terms equal the biggest number in that table

 

 

Please upvote if this is helpful

Eugene


Reply