cancel
Showing results for
Did you mean:
Post Prodigy

## How count value according to these values of rows?

Counting subtraction I expect to get 2000. So how write DAX formula in order to get this result? We have same object, it's id but different date with value, credit and debet. So if date is bigger than cre-det.

I have tried this

Sukaupta_suma =
var _max = maxx(filter('x', [DATE] <[DATE]),[DATE])

var _val = sumx(filter('x',[DATE] =_max), [CRE]-[DET])

return
[CRE]-[DEB]

But this not helped because I am getting 8000
-6000, as the result.
1 ACCEPTED SOLUTION
Community Support

Hi, @Analitika

Try to modify @Marik 's formula as below:

``````Result =
VAR Credit =
CALCULATE ( SUM ( 'Table'[CRE] ), ALLEXCEPT ( 'Table', 'Table'[OBJ_ID] ) )
VAR Debit =
CALCULATE ( SUM ( 'Table'[DET] ), ALLEXCEPT ( 'Table', 'Table'[OBJ_ID] ) )
RETURN
Credit - Debit``````

Best Regards,
Community Support Team _ Eason

3 REPLIES 3
Solution Supplier

@Analitika Straightforward way:

Measure=var Credit=SUM('your_table'[CRE])

var Debit=SUM('you_table'[DET])

return Credit-Debit

Post Prodigy

Is wrong because I have many different object with values it's sum all table values.

Community Support

Hi, @Analitika

Try to modify @Marik 's formula as below:

``````Result =
VAR Credit =
CALCULATE ( SUM ( 'Table'[CRE] ), ALLEXCEPT ( 'Table', 'Table'[OBJ_ID] ) )
VAR Debit =
CALCULATE ( SUM ( 'Table'[DET] ), ALLEXCEPT ( 'Table', 'Table'[OBJ_ID] ) )
RETURN
Credit - Debit``````

Best Regards,
Community Support Team _ Eason

Announcements

#### Launching new user group features

Learn how to create your own user groups today!