Forum Discussion

VictorV's avatar
VictorV
Helper I
2 years ago
Solved

Need help on create custom column with condition.

Need help on create custom column with condition.    Explain: I have table 2 like below, it have table2[customer code] = table1[customer code] , and table2[code product] sometimes match with table1...
  • ryan_mayu's avatar
    2 years ago

    VictorV 

    pls try this

    Column =
    VAR _check=maxx(FILTER('Table 1','Table 1'[code product]='Table 2'[Code product]&&'Table 1'[Customer code]='Table 2'[Customer Code]),'Table 1'[Amount])
    VAR _check2=maxx(FILTER('Table 1','Table 1'[code product]='Table 2'[Code product]&&'Table 1'[Customer code]='Table 2'[Customer Code]&&'Table 1'[Date]='Table 2'[Date]),'Table 1'[Amount])
    return if(not(ISBLANK(_check)),if(not(ISBLANK(_check2)),_check2,if(ISBLANK('Table 2'[Date]),_check)))
     
    pls see the attachment below