Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
VictorV
Helper I
Helper I

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[code product], because after year it will reset to 1. Then I have table2[Amount] also sometimes will be incorect due to user input wrong, the table1[Amount] is the correct one and the Table2[Date] also sometimes have date on it, but the date is correct, and table2[Date] = table1[Date]

 

What I need now:

I need create a custome column [Amount] in Table 2, base on condition:

IF table2[code product] = table1[code product], then it will check for table2[customer code] = table1[customer code], then it will check for the Date,

incase 1: the table2[Date] is not have value, then it will check for Amount, and if the Amount is correct it will use that table1[Amount] and the table1[Date]

incase 2: the table2[Date] is appear and = table1[Date], then it will check the table1[Amount] = table2[Amount], in any situation of [Amount], it will always use table1[Amount]

VictorV_0-1712772460888.png

Please help me!!!!!!!!!!!

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@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)))
 
11.PNG
pls see the attachment below




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@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)))
 
11.PNG
pls see the attachment below




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Thanks so much!!! it's work perfect

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.