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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
ANB_13
Helper I
Helper I

Help Excel formula to Dax

Hello everyone, 

 

Please, someone can help me to covert this excel formula to DAX ?

 

"=IF(OR([@[NATURE CODE 1]]="A",[ @[NATURE CODE 1]]="W");([@[%VOL. CN1]]/100)*[@[GROSS MASS (kg)]];0)+SI(OU([@[NATURE CODE 2]]="A";[ @[NATURE CODE 2]]="W");([@[%Vol. CN2]]/100)*[@[GROSS MASS (kg)]];0)"

 

Thank you very much 

Regards

1 ACCEPTED SOLUTION
rubayatyasmin
Community Champion
Community Champion

Hi, @ANB_13 

 

try this one:

 

= IF(
OR(
TableName[NATURE CODE 1] = "A",
TableName[NATURE CODE 1] = "W"
),
(TableName[%VOL. CN1] / 100) * TableName[GROSS MASS (kg)],
0
) + IF(
OR(
TableName[NATURE CODE 2] = "A",
TableName[NATURE CODE 2] = "W"
),
(TableName[%Vol. CN2] / 100) * TableName[GROSS MASS (kg)],
0
)

 

replace the table with your appropriate table name. 

 

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


View solution in original post

3 REPLIES 3
ANB_13
Helper I
Helper I

Hello, 

Thank you very much, 

 

I want it also in M language. Can ou help me please ?

 

Thank you very much

sure, 

 

let
Source = TableName,
DAXFormula = (Table as table) =>
let
Result1 = if List.Contains({"A", "W"}, Table[NATURE CODE 1]) then (Table[%VOL. CN1] / 100) * Table[GROSS MASS (kg)] else 0,
Result2 = if List.Contains({"A", "W"}, Table[NATURE CODE 2]) then (Table[%Vol. CN2] / 100) * Table[GROSS MASS (kg)] else 0,
FinalResult = Result1 + Result2
in
FinalResult,
CustomColumn = Table.AddColumn(Source, "Converted", each DAXFormula(_))
in
CustomColumn

 

 

if my assistance helped you in any way. hit 👍

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


rubayatyasmin
Community Champion
Community Champion

Hi, @ANB_13 

 

try this one:

 

= IF(
OR(
TableName[NATURE CODE 1] = "A",
TableName[NATURE CODE 1] = "W"
),
(TableName[%VOL. CN1] / 100) * TableName[GROSS MASS (kg)],
0
) + IF(
OR(
TableName[NATURE CODE 2] = "A",
TableName[NATURE CODE 2] = "W"
),
(TableName[%Vol. CN2] / 100) * TableName[GROSS MASS (kg)],
0
)

 

replace the table with your appropriate table name. 

 

 

rubayatyasmin_0-1689517080227.png


Did I answer your question? Mark my post as a solution!super-user-logo

Proud to be a Super User!


Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

Check out the February 2026 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.