March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
I have a input table like this
i need a output column (i.e Output Amount ) I need a Dax measure to solve this scenerio
the table attached below is the explanation table to fetch my desired output.
Solved! Go to Solution.
Hi @LB-Tech ,
Try to create the following measures:
Credit Total = SUM('Table'[Credit])
Debit Total = SUM('Table'[Debit])
Remaining Total =
VAR _totalCredit = CALCULATE(
[Credit Total],
ALL('Table'[Date])
)
VAR _Remaining = _totalCredit - CALCULATE(
[Debit Total],
'Table'[Date] <= MAX('Table'[Date])
)
RETURN
IF(
_Remaining > 0,
_Remaining,
0
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @MFelix
Thankyou for you DAX it worked well for Remaining Total Column, But my desired output is the last column (Output Amount Column) Could you guide me for the Output Column.
Hi @LB-Tech ,
Apologies for the incorrection change the measure Remaininig Total and add a new one:
Remaining Total =
VAR _totalCredit = CALCULATE(
[Credit Total],
ALL('Table'[Date])
)
VAR _Remaining = _totalCredit - CALCULATE(
[Debit Total],
'Table'[Date] <= MAX('Table'[Date])
)
Return
_Remaining
Output Amount =
VAR _PreviousRemaining = SUMX(
TOPN(
1,
FILTER(
ALL('Table'[Date]),
'Table'[Date] < MAX('Table'[Date])
),
'Table'[Date],
DESC
),
[Remaining Total]
)
RETURN
SWITCH(
TRUE(),
_PreviousRemaining = BLANK(), [Debit Total] - [Debit Total],
_PreviousRemaining > [Debit Total], [Debit Total] - MIN(
[Debit Total],
_PreviousRemaining
),
_PreviousRemaining > 0, [Debit Total] - MAX(
_PreviousRemaining,
0
),
[Debit Total] - 0
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsHi @MFelix
The first Remaining Total Measure got right, but I am not getting the output amount measure
But still figured out the required output by different measure.
Thankyou for your help.
Hi @LB-Tech ,
There isn't enough information to get the values that you need, the first one I see is on the first row were you do a calculation 72.200 - 59.000. Where are the 72.200 coming from?
Also can you please share some mockup file and a litle bit more context in terms of semantic model?
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em Português72200 is the total of the credit side. i have n no of party's, and they have debit and credit column. i need to take the total of the credit side of a party and set off against the debit column by date order. Then my output should be output column where i need the balance of debit amount date wise after setting off the credit total.
Hi @LB-Tech ,
Try to create the following measures:
Credit Total = SUM('Table'[Credit])
Debit Total = SUM('Table'[Debit])
Remaining Total =
VAR _totalCredit = CALCULATE(
[Credit Total],
ALL('Table'[Date])
)
VAR _Remaining = _totalCredit - CALCULATE(
[Debit Total],
'Table'[Date] <= MAX('Table'[Date])
)
RETURN
IF(
_Remaining > 0,
_Remaining,
0
)
Regards
Miguel Félix
Proud to be a Super User!
Check out my blog: Power BI em PortuguêsMarch 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.
User | Count |
---|---|
125 | |
85 | |
69 | |
53 | |
44 |
User | Count |
---|---|
204 | |
105 | |
99 | |
64 | |
54 |