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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
UI
Frequent Visitor

Convert Excel logic to DAX

Hi Datafam.

I want to convert my excel formula "=IF(OR(AB6<>0,AL6="A"),SUMPRODUCT(--($E$6:$E$5160=E6),--($G$6:$G$5160=G6),--($M$6:$M$5160=M6),--($AK$6:$AK$5160<>"E"),$Y$6:$Y$5160),0)" into DAX.

Thanks,
Pratik.S


1 ACCEPTED SOLUTION
v-xiaotang
Community Support
Community Support

Hi @UI 

"=IF(OR(AB6<>0,AL6="A"),SUMPRODUCT(--($E$6:$E$5160=E6),--($G$6:$G$5160=G6),--($M$6:$M$5160=M6),--($AK$6:$AK$5160<>"E"),$Y$6:$Y$5160),0)"

you can try this, create a column

column=

var _expression_true= SUMX(<table>, <expression>) // This corresponds to SUMPRODUCT()

var _expression_false=0

return

if( table[column AB6]<>0 ||  table[column AL6]="A", _expression_true,_expression_false)

in excel you could sum up individual cells but in power bi, when you use a sum function it's summing up the entire column. So when doing summation calculation, we need to filter the table.

since not sure what are you trying to sum up, could you share some sample data? then we can work on it further.

Also, please watch this video, it will help starters to understand DAX.

📊 How to use Power BI DAX - Tutorial - YouTube

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-xiaotang
Community Support
Community Support

Hi @UI 

"=IF(OR(AB6<>0,AL6="A"),SUMPRODUCT(--($E$6:$E$5160=E6),--($G$6:$G$5160=G6),--($M$6:$M$5160=M6),--($AK$6:$AK$5160<>"E"),$Y$6:$Y$5160),0)"

you can try this, create a column

column=

var _expression_true= SUMX(<table>, <expression>) // This corresponds to SUMPRODUCT()

var _expression_false=0

return

if( table[column AB6]<>0 ||  table[column AL6]="A", _expression_true,_expression_false)

in excel you could sum up individual cells but in power bi, when you use a sum function it's summing up the entire column. So when doing summation calculation, we need to filter the table.

since not sure what are you trying to sum up, could you share some sample data? then we can work on it further.

Also, please watch this video, it will help starters to understand DAX.

📊 How to use Power BI DAX - Tutorial - YouTube

 

Best Regards,

Community Support Team _Tang

If this post helps, please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@UI , Can you share what calculation is needed

 

You can sumx or productX

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.