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
Stuznet
Helper V
Helper V

Sum both Columns if the Condition is Met

Hi guys,

 

I am trying to make a new measure in Power BI Desktop but I can not make it to work. 

 

The situation:

If Col1 and Col2 is >0.99 then I would like to sum ATE and EA  

 

2018-10-19_14-14-17.jpg

 

Can someone please help me?

Thanks

2 ACCEPTED SOLUTIONS

Hi,

 

Do you mean this

 

=IF([Col1]>0.99&&[Col2]>0.99&&[Col1]<1.2&&[Col2]<1.2,MAX(0,[ATE]+[EA]),BLANK())


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

Anonymous
Not applicable

Just to add that this is possible with a measure using SUMX (). Whether this is better than the column depends on your use case.

 

Measure =
SUMX (
    Table,
    IF (
        Table[Col1] > 0.99
            && Table[Col1] < 1.2
            && Table[Col2] > 0.99
            && Table[Col2] < 1.2,
        Table[ATE] + Table[EA],
        0
    )
)

View solution in original post

8 REPLIES 8
Ashish_Mathur
Super User
Super User

Hi,

 

I think you need a calculated column formula.  Try this

 

=IF(AND([Col1]>0.99,[Col2]>0.99),[ATE]+[EA],BLANK())

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you for providing me the solution 🙂 . I just came up with another condition that instead of greater than 0.99. How can input “0.99 - 1.20” ? (The dash is not a minus )

Hi,

 

Hi,

 

Try this calculated column formula

 

IF([Col1]>0.99&&[Col2]>0.99&&[Col1]<1.2&&[Col2]<1.2,[ATE]+[EA],BLANK())


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thank you so much but is there a way to not to include the negative value?

hi, @Stuznet

what is the expected output of is there a way to not to include the negative value?

 

 

IF(logical_test>,<value_if_true>, value_if_false)

You can just add your condition in logical_test, and it will work as you expect.

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Just to add that this is possible with a measure using SUMX (). Whether this is better than the column depends on your use case.

 

Measure =
SUMX (
    Table,
    IF (
        Table[Col1] > 0.99
            && Table[Col1] < 1.2
            && Table[Col2] > 0.99
            && Table[Col2] < 1.2,
        Table[ATE] + Table[EA],
        0
    )
)

@Ashish_Mathur @Anonymous Thank you so much for your help. Both solutions worked 🙂

Hi,

 

Do you mean this

 

=IF([Col1]>0.99&&[Col2]>0.99&&[Col1]<1.2&&[Col2]<1.2,MAX(0,[ATE]+[EA]),BLANK())


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

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.