Forum Discussion

setis's avatar
setis
Post Partisan
7 years ago
Solved

LOOKUPVALUE help

Dear all, I am struggling with a relative simple issue. 

 

I have 2 tables, [Receivables] and [Payables]

 

These 2 tables are joined through: 

Payables [External No.] to Receivables [Document No.]) on a 1 to many. (1 [Document No.] can have many [External No.])
 
I am trying to see which lines in [Receivables] does or does not have a match in [Payables].
 
I achieved this with a measure:
Invoice status = 
IF(ISBLANK(
CALCULATE(COUNTA(Receivables[Document No.]);
            FILTER(ALL(Receivables);
                    Receivables[Document No.]=(MAX('Payables[External No.])))));"Not Invoiced";"Invoiced")
but I actually need this as a calculated column in the table [Receivables]
 
I am trying different things but nothing is working for me. Last attemp was:
 
Inv. status(WRONG) = 
IF(HASONEVALUE('Payables'[External Document No.]);
LOOKUPVALUE('Payables'[Entry No.];'Payables'[External No.];Receivables[Document No.]);"")
Could someone point me in the right direction, please?
  • setis -

     

    Maybe this will work for you:

    Column =
    VAR countReceivables =
        CALCULATE (
            COUNTROWS ( Payables ),
            ALLEXCEPT ( Receivables, Receivables[Document No.] )
        )
    RETURN
        IF ( ISNUMBER ( countReceivables ), "Invoiced", "Not Invoiced" )

     

     

2 Replies

  • ChrisMendoza's avatar
    ChrisMendoza
    Resident Rockstar

    setis -

     

    Maybe this will work for you:

    Column =
    VAR countReceivables =
        CALCULATE (
            COUNTROWS ( Payables ),
            ALLEXCEPT ( Receivables, Receivables[Document No.] )
        )
    RETURN
        IF ( ISNUMBER ( countReceivables ), "Invoiced", "Not Invoiced" )

     

     

    • setis's avatar
      setis
      Post Partisan

      Dear ChrisMendoza,

       

      It does work. Thank you so much!

       

      I really appreciate you taking the time to create a file and check this for me. I should have included a file myself. :)