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
Anonymous
Not applicable

Ignoring Negative Values in Calculated Column

Hi There,

 

I am trying to create a calculated meaure where i am going subtraction from two columns which contains values as below :

Snip_power.JPG

I need the result value which is showing in green(2) however when i am doing subtraction from (Ask-Actual) i am getting a result (-1) however i want to ignore negative values in my measure so that my result value will appear as (2).

 

I have created 3 measures which are as below :

Total_Ask=Sum(ask)

Total Actual-Sum(Actual)
Gap=Total Ask-Total Actual

 

Can anyone please help me in figuring out how can i calculate Gap while ignoring Negative values?

 

Regards,

Ashish 

2 ACCEPTED SOLUTIONS
amitchandak
Super User
Super User

@Anonymous , of those, are column

 

sumx(table, if([Total Ask]-[Total Actual]>0 ,[Total Ask]-[Total Actual], blank()) )

View solution in original post

v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please check the formula.

measure1 = SUM('Table'[ask])-SUM('Table'[actual])

Measure2 = IF([measure1]<0,0,[measure1])

Measure3 = IF(ISINSCOPE('Table'[ask]),[measure1],SUMX(ALL('Table'),[Measure2]))

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Please check the formula.

measure1 = SUM('Table'[ask])-SUM('Table'[actual])

Measure2 = IF([measure1]<0,0,[measure1])

Measure3 = IF(ISINSCOPE('Table'[ask]),[measure1],SUMX(ALL('Table'),[Measure2]))

1.PNG

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@Anonymous , of those, are column

 

sumx(table, if([Total Ask]-[Total Actual]>0 ,[Total Ask]-[Total Actual], blank()) )

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.

Top Solution Authors