how to get a value in a related columns using condition

chiukim_0-1671091511275.png

I have two tables s_bpartner and nvt_sales. The latter has the key id of the former. So I ref it and the former table has now a related column.
In related columns how to formula if im going to get nvt_i_sku_id who has the biggest qty.
Is it possible without using a slice for top()? Coz it affects the performance of my app if im going to use slice.

Solved Solved
0 4 221
1 ACCEPTED SOLUTION

I believe this question is a follow up of the below question. There you had mentioned that the 2 tables are not referenced.

Getting the top product based on amount - Google Cloud Community

In this case since the two tables are referenced, please create a VC of ref type called say [Ref Biggest Qty] with an expression something like 

INDEX( ORDERBY([Related nvt_t_saleslines], [Qty], TRUE) , 1)

Please ensure this VC has reference table named as "nvt_t_saleslines". This VC will get the nvt_sku_id if it is the key of that table.

Then in another VC called sat [Biggest Qty], you will get the biggest quantity with an expression something like 

[Ref Biggest Qty].[Qty]

View solution in original post

4 REPLIES 4

MAXROW(
 "nvt_sales",
 "qty",
 [s_bpartner in nvt_sales] = [_THISROW]
)

chiukim_0-1671093804950.png

Hello. Its error. How can i get the nvt_i_sku_id?

I guess I cannot answer your q because I do not know the structure of your tables fully..

I believe this question is a follow up of the below question. There you had mentioned that the 2 tables are not referenced.

Getting the top product based on amount - Google Cloud Community

In this case since the two tables are referenced, please create a VC of ref type called say [Ref Biggest Qty] with an expression something like 

INDEX( ORDERBY([Related nvt_t_saleslines], [Qty], TRUE) , 1)

Please ensure this VC has reference table named as "nvt_t_saleslines". This VC will get the nvt_sku_id if it is the key of that table.

Then in another VC called sat [Biggest Qty], you will get the biggest quantity with an expression something like 

[Ref Biggest Qty].[Qty]

Top Labels in this Space