Forum Discussion
Measure calculation subtraction
I have below table visuals and I need to calculate subtraction
NOTACTIONED output is Totalcount-Action and it should not be negative
Date. TOTALCOUNT. ACTION NOACTIONED
13/3/25. 20. 62. 42
bzeeblitz Open your Power BI report and select the table visual where you want to add the NOACTIONED column.
Click on the "Modeling" tab and then "New column" to create a new calculated column.
Enter the following DAX formula:NOACTIONED = IF([TOTALCOUNT] - [ACTION] < 0, 0, [TOTALCOUNT] - [ACTION])
According to the dataset you passed, you have to use ABS
NOACTIONED = ABS([TOTALCOUNT] - [ACTION])Or just to do:
NOACTIONED = [ACTION] - [TotalCOUNT]
NOTACTIONED = MAX(0, [TotalCount] - [Action])
[TotalCount]-[action]: This part calculates the difference between the two measures [TotalCount] and [action].
max(0,..) The max function ensures that if the result of the subtraction is negative, it will return 0 instead of a negative number. Essentially, this function compares 0 with the calculated result, and returns the larger of the two. So, if the difference is negative, it will return 0 , and if it's positive, it will return the actual difference.
3 Replies
- bhanu_gautamSuper User
bzeeblitz Open your Power BI report and select the table visual where you want to add the NOACTIONED column.
Click on the "Modeling" tab and then "New column" to create a new calculated column.
Enter the following DAX formula:NOACTIONED = IF([TOTALCOUNT] - [ACTION] < 0, 0, [TOTALCOUNT] - [ACTION])
- CookistadorSuper User
According to the dataset you passed, you have to use ABS
NOACTIONED = ABS([TOTALCOUNT] - [ACTION])Or just to do:
NOACTIONED = [ACTION] - [TotalCOUNT]
- randomUser21Resolver I
NOTACTIONED = MAX(0, [TotalCount] - [Action])
[TotalCount]-[action]: This part calculates the difference between the two measures [TotalCount] and [action].
max(0,..) The max function ensures that if the result of the subtraction is negative, it will return 0 instead of a negative number. Essentially, this function compares 0 with the calculated result, and returns the larger of the two. So, if the difference is negative, it will return 0 , and if it's positive, it will return the actual difference.