Forum Discussion
ignore values less than zero
- 8 years ago
Hi eburke
You should be able to use the IF function for this.
= IF ([Customer Assigned] - [PrePaid] < 0 , 0 , [Customer Assigned] - [PrePaid] )
- 8 years ago
HI eburke
Just wrap a SUMX Function around it to force the Total calc to be row by row
Measure 2 = SUMX( 'Table2', IF( 'Table2'[Customer Assigned]-'Table2'[Pre Paid]>0, -- THEN -- 'Table2'[Customer Assigned]-'Table2'[Pre Paid], -- ELSE -- 0) )
- 8 years ago
When I try this formula the THEN and ELSE come up green like Power BI doesn't recognise it as a function. Also will it matter that the Customer Assigned and PrePaid Meaures are on different tables? Thanks,
Hi eburke
You should be able to use the IF function for this.
= IF ([Customer Assigned] - [PrePaid] < 0 , 0 , [Customer Assigned] - [PrePaid] )
Thank you, I thought it was something like that I just had my brackets in the wrong place.
My issue now is how do I apply that to the Totals at the bottom of the table, otherwise it does Total CA - Total PrePaid = Billable Hours, whereas I actually want to show the column total of Billable Hours
- Phil_Seamark8 years agoMicrosoft Employee
HI eburke
Just wrap a SUMX Function around it to force the Total calc to be row by row
Measure 2 = SUMX( 'Table2', IF( 'Table2'[Customer Assigned]-'Table2'[Pre Paid]>0, -- THEN -- 'Table2'[Customer Assigned]-'Table2'[Pre Paid], -- ELSE -- 0) )
- eburke8 years agoHelper II
When I try this formula the THEN and ELSE come up green like Power BI doesn't recognise it as a function. Also will it matter that the Customer Assigned and PrePaid Meaures are on different tables? Thanks,
- Phil_Seamark8 years agoMicrosoft Employee
HI eburke
These are comments and just designed to explain the logic. The green colour highlights comments :)