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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Analitika
Post Prodigy
Post Prodigy

How count value according to these values of rows?

Analitika_0-1634046057770.png

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

Hi, @Analitika 

Try to modify @Anonymous '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

 

159.png

 

Best Regards,
Community Support Team _ Eason

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

@Analitika Straightforward way:

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

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

return Credit-Debit

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

Hi, @Analitika 

Try to modify @Anonymous '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

 

159.png

 

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.