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
Niels_T
Post Patron
Post Patron

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.
1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

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

 

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

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

 

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.