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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Super User
Super User

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
Super User
Super User

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Top Solution Authors