Hey guys. I have a challenge that has me stuck. I have a data dump of bank transactions. The simplified data looks like this:
[TABLE="width: 500, align: center"]
<tbody>[TR]
[TD]OpeningLedgerBal[/TD]
[TD]Debit[/TD]
[TD]Credit[/TD]
[TD]EndRunningLedger[/TD]
[/TR]
[TR]
[TD]250
[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]320[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]340[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]300[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD][/TD]
[TD]100[/TD]
[TD]350[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]330[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]310[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]290[/TD]
[/TR]
</tbody>[/TABLE]
My goal is to create a helper column that orders the transactions like this:
[TABLE="width: 500, align: center"]
<tbody>[TR]
[TD]OpeningLedgerBal[/TD]
[TD]Debit[/TD]
[TD]Credit[/TD]
[TD]EndRunningLedger[/TD]
[TD]Order#[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]320[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]340[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]300[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD][/TD]
[TD]100[/TD]
[TD]350[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]330[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]310[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]290[/TD]
[TD]7[/TD]
[/TR]
</tbody>[/TABLE]
My ultimate goal is to get a working DAX formula but a regular formula might help me get there. I cannot think of a solution that doesn't throw a circular reference error. My first attempt was this:
=IF([OpeningLedgerBal]-[Debit Amt]+[Credit Amt]=[RunningLedgerBal],"1",LOOKUPVALUE([Order#],[RunningLedgerBal],[CalcBegLedgerBal])+1)
Where [CalcBegLedgerBal] was a helper column. Any ideas? I would appreciate any input at all!
[TABLE="width: 500, align: center"]
<tbody>[TR]
[TD]OpeningLedgerBal[/TD]
[TD]Debit[/TD]
[TD]Credit[/TD]
[TD]EndRunningLedger[/TD]
[/TR]
[TR]
[TD]250
[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]320[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]340[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]300[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD][/TD]
[TD]100[/TD]
[TD]350[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]330[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]310[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]290[/TD]
[/TR]
</tbody>[/TABLE]
My goal is to create a helper column that orders the transactions like this:
[TABLE="width: 500, align: center"]
<tbody>[TR]
[TD]OpeningLedgerBal[/TD]
[TD]Debit[/TD]
[TD]Credit[/TD]
[TD]EndRunningLedger[/TD]
[TD]Order#[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]320[/TD]
[TD]4[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]340[/TD]
[TD]2[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]300[/TD]
[TD]6[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD][/TD]
[TD]100[/TD]
[TD]350[/TD]
[TD]1[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]330[/TD]
[TD]3[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]310[/TD]
[TD]5[/TD]
[/TR]
[TR]
[TD]250[/TD]
[TD]10[/TD]
[TD][/TD]
[TD]290[/TD]
[TD]7[/TD]
[/TR]
</tbody>[/TABLE]
My ultimate goal is to get a working DAX formula but a regular formula might help me get there. I cannot think of a solution that doesn't throw a circular reference error. My first attempt was this:
=IF([OpeningLedgerBal]-[Debit Amt]+[Credit Amt]=[RunningLedgerBal],"1",LOOKUPVALUE([Order#],[RunningLedgerBal],[CalcBegLedgerBal])+1)
Where [CalcBegLedgerBal] was a helper column. Any ideas? I would appreciate any input at all!