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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
MS3
Frequent Visitor

SUM value is Row in a Column Equals a Specific Value and Value is Greater than Zero

 

Hello!

 

I am trying to SUM Values [Amount] if a Column [FS Item (Account)] is Equal to a Specific Value [173] and the [Amount] is Positive / Greater than Zero.

 

The formula I have to SUM the values is

CALCULATE (
    SUM ( Masterdata[Amount] ),
    Masterdata[FS Item (Account)]="173"
)
 
which provides the SUM, but I am unsure how to add the condition for it to add only the [Amount] that are greater than zero.
 
Would appreciate any help.
 
Best regards,

 

1 ACCEPTED SOLUTION
Pragati11
Super User
Super User

Hi @MS3 ,

 

Try the following DAX:

 

CALCULATE (
                     SUM ( Masterdata[Amount] ),
                     FILTER(
                                 Masterdata, Masterdata[FS Item (Account)]="173" && Masterdata[Amount] > 0
                                )
)
 
Kindly give Kudos if the solution is helpful and Mark it as a solution if it resolves the issue! 🙂
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

View solution in original post

5 REPLIES 5
Pragati11
Super User
Super User

Hi @MS3 ,

 

Try the following DAX:

 

CALCULATE (
                     SUM ( Masterdata[Amount] ),
                     FILTER(
                                 Masterdata, Masterdata[FS Item (Account)]="173" && Masterdata[Amount] > 0
                                )
)
 
Kindly give Kudos if the solution is helpful and Mark it as a solution if it resolves the issue! 🙂
 
Thanks,
Pragati

Best Regards,

Pragati Jain


MVP logo


LinkedIn | Twitter | Blog YouTube 

Did I answer your question? Mark my post as a solution! This will help others on the forum!

Appreciate your Kudos!!

Proud to be a Super User!!

MS3
Frequent Visitor

 

Thank you very much!!!

 

It worked wonderfully!

Anonymous
Not applicable

it should be like this 
CALCULATE (
    SUM ( Masterdata[Amount] ),
    Masterdata[FS Item (Account)]="173"
    && [Amount] >0
)
MS3
Frequent Visitor

 

Needed to add the table for Amount as per below:

 

CALCULATE (    SUM ( Masterdata[Amount] ),
    Masterdata[FS Item (Account)]="173"
    && Masterdata [Amount] >0
)

 

When I use the expression it tells me

"The expression contains multiple columns, but only a single column can be used in a True / False expression that is used as a Table Filter Expression"

 

Indeed [Amount] and [FS Item (Account)]] are columns in my Masterdata table.

 

 

Anonymous
Not applicable

sry, my bad 
do like this with a filter function :

scr.png

 

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

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.

Top Solution Authors