Forum Discussion

HB2104's avatar
HB2104
Icon for Helper I rankHelper I
3 years ago
Solved

DAX If Vlookup Statements

Hello -   I am trying to create a DAX that is a multiple if statement vlook up. The statement is if CoCd column is KHLT & USD than lookup in Bank info column for correct bank info (in that statemen...
  • barritown's avatar
    3 years ago

    Hi HB2104,

    Try a calculated column like this:

    And in plain text for convenience:

    New Calculated Column = 
    VAR _CurrentCoCd = [CoCd]
    VAR _CurrentCurrency = [Currency]
    RETURN COALESCE ( 
        MAXX ( FILTER ( Tbl2, [Company] = _CurrentCoCd && [Currency] = _CurrentCurrency ), [Bank Info] ),
        MAXX ( FILTER ( Tbl2, [Company] = _CurrentCoCd && CONTAINSSTRING ( [Currency], "ALL OTHER" ) ), [Bank Info] ) )

    Best Regards,

    Alexander

    My YouTube vlog in English

    My YouTube vlog in Russian

     

  • HB2104's avatar
    3 years ago

    Thank you, awesome! I assume Tb12 in this is the table for the bank numbers?

  • barritown's avatar
    barritown
    3 years ago

    Yup, it's the second table with the columns [Company], [Currency] and [Bank Info]. In fact, it's "Tbl2", short for "Table 2". 🙂

  • HB2104's avatar
    HB2104
    3 years ago

    Thank you so much! Does it matter about the columns in these being "text" vs "number"? Like lets say I had the bank info and it wasn't just numbers it also had letters in it as well. 

  • barritown's avatar
    barritown
    3 years ago

    There shouldn't be any problems with text.

  • HB2104's avatar
    HB2104
    3 years ago
    Works great, thank you!