Forum Discussion

Niels_T's avatar
Niels_T
Icon for Post Patron rankPost Patron
5 years ago
Solved

How to make lookupvalue with if function in DAX

Hello,

 

I am trying to make a new column with a DAX-function where I look into another table and search for a column to find the value "credit memo". If the value is true then it will return a formula, else it will return a different formula.

 

So far I made something like this but it doesn't work:

 

Currency Factor =
IF
(LOOKUPVALUE('xxxx NV$Sales Invoice + Cr_Memo Header'[Document Type],'xxxxNV$Sales Invoice + Cr_Memo Header'[Document Type], "Credit Memo"),
 
LOOKUPVALUE('xxxxNV$Sales Invoice + Cr_Memo Header'[Currency Factor],'xxxxNV$Sales Invoice + Cr_Memo Header'[No_], 'Aerts NV$Sales Invoice + Cr_Memo Line'[Document No_])*-1,
 
LOOKUPVALUE('xxxxNV$Sales Invoice + Cr_Memo Header'[Currency Factor],'xxxxNV$Sales Invoice + Cr_Memo Header'[No_], 'xxxxNV$Sales Invoice + Cr_Memo Line'[Document No_]))
 
Error: Cannot convert value 'Credit Memo' of type Text to type True/False.
  • Niels_T , thsi value from lookup should be compared

    LOOKUPVALUE('xxxx NV$Sales Invoice + Cr_Memo Header'[Document Type],'xxxxNV$Sales Invoice + Cr_Memo Header'[Document Type], "Credit Memo")

     

    Like have some value

    if(not(isblank(LOOKUPVALUE('xxxx NV$Sales Invoice + Cr_Memo Header'[Document Type],'xxxxNV$Sales Invoice + Cr_Memo Header'[Document Type], "Credit Memo"))) ,

    <Then> ,<else>)

     

1 Reply

  • Niels_T , thsi value from lookup should be compared

    LOOKUPVALUE('xxxx NV$Sales Invoice + Cr_Memo Header'[Document Type],'xxxxNV$Sales Invoice + Cr_Memo Header'[Document Type], "Credit Memo")

     

    Like have some value

    if(not(isblank(LOOKUPVALUE('xxxx NV$Sales Invoice + Cr_Memo Header'[Document Type],'xxxxNV$Sales Invoice + Cr_Memo Header'[Document Type], "Credit Memo"))) ,

    <Then> ,<else>)