Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
SBGoh
Helper I
Helper I

How 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 advise ? Thank you! 

 

SBGoh_1-1696932679313.png

 

 

4 REPLIES 4
danextian
Super User
Super User

Hi @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).

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Hi, 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" ? 

Hi, I have a Sales Order with SO # = 1900 with a list of 3 partners records. (The 2 tables are link by SO #).

The Code = 'ZC' refers to CS executive and there are 2 CS. I only want to display 1 CS record with highest POS #. In this case is the blue highlighed record with Code = 'ZC' and POS # = 0011 and CS No. = 2244.

 

Partner table

SO #POS #CodeCS No.
19000000VE1234
19000011ZC2244
19000000ZC3355

 

Sales Order table

SO #POS #Material
19000011PartNum 1
19000022PartNum 2

Please check the formulas i inititally provided. Either one should work.

danextian_0-1697009138498.png

danextian_1-1697009165695.png

 

 










Did I answer your question? Mark my post as a solution!


Proud to be a Super User!









"Tell me and I’ll forget; show me and I may remember; involve me and I’ll understand."
Need Power BI consultation, get in touch with me on LinkedIn or hire me on UpWork.
Learn with me on YouTube @DAXJutsu or follow my page on Facebook @DAXJutsuPBI.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.