Forum Discussion
SBGoh
Helper I
3 years agoHow to get filtered lookup table?
Hi, I want to get 2 tables below and they are link by SO #. I want to get the CS No. with the highest POS # where Code = 'ZC'. I am trying to use lookup table but seems not working. Can anyone a...
danextian
Super User
3 years agoHi SBGoh
I don't quite understand what you mean by you want to get 2 tables. If you're trying to get the CS No in Partner wherein the POS # is the max for each POS # and which SO # is equal to the current row in SO # in Sales Order, you can try either of these:
=
CALCULATE (
MAX ( Partner[CS No.] ),
FILTER (
Partner,
VAR MaxPO =
CALCULATE ( MAX ( Partner[POS #] ), ALLEXCEPT ( Partner, Partner[SO #] ) )
RETURN
Partner[SO No] = EARLIER ( SalesOrder[SO N#] )
&& Partner[POS #] = MaxPO
&& Partner[Code] = "ZC"
)
)
=
VAR MaxPO =
CALCULATE (
MAX ( Partner[POS #] ),
FILTER ( Partner, Partner[SO #] = EARLIER ( SalesOrder[SO N#] ) )
)
RETURN
CALCULATE (
MAX ( Partner[CS No.] ),
FILTER (
Partner,
Partner[SO No] = EARLIER ( SalesOrder[SO N#] )
&& Partner[POS #] = MaxPO
&& Partner[Code] = "ZC"
)
)
Otherwise, please post a sample data that we can copy-paste (not an image).
SBGoh
Helper I
3 years agoHi, may I know what is the purpose of 'Earlier"? I try to read the explanation from Microsoft but I don't seems to understand. What if I don't use "Earlier"?
If my CS No. contain text like "P1234", can I still use "MAX" ?