Forum Discussion
pbi1908
3 years agoHelper III
Calculate Running Balance
Hi dear all, I have a problem of how to calculate the Running Balance. I already have a table with the Allocation of each payment and the history of an Invoice. In my table if i have an Invoic...
- Anonymous3 years ago
Hi pbi1908 ,
Here are the steps you can follow:
1. Create calculated table.
Table 2 = CALENDAR( DATE(2023,2,1), DATE(2023,12,31))2. Create measure.
Flag = var _select=SELECTEDVALUE('Table 2'[Date]) return IF( MAX('Table'[INVOICE_DATE])=MINX(FILTER(ALL('Table'),'Table'[CUSTOMER_ID]=MAX('Table'[CUSTOMER_ID])),[INVOICE_DATE]) && MAX('Table'[INVOICE_ID])=MINX(FILTER(ALL('Table'),'Table'[CUSTOMER_ID]=MAX('Table'[CUSTOMER_ID])),[INVOICE_ID]) , MAX('Table'[REMAINING_BALANCE]), IF( MAX('Table'[PAYMENT_DATE])=BLANK()&&MAX('Table'[INVOICE_ID])<>MINX(FILTER(ALL('Table'),'Table'[CUSTOMER_ID]=MAX('Table'[CUSTOMER_ID])),[INVOICE_ID]),BLANK(), IF( MAX('Table'[PAYMENT_DATE])<=_select,MAX('Table'[REMAINING_BALANCE]),BLANK()) ))Sum_All = SUMX( ALL('Table'),[Flag])3. Result:
[Invoice_id]=101 is also during slicer filtering, so it is also added
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Anonymous
3 years agoNot applicable
Hi pbi1908 ,
Here are the steps you can follow:
1. Create calculated table.
Table 2 =
CALENDAR(
DATE(2023,2,1),
DATE(2023,12,31))
2. Create measure.
Flag =
var _select=SELECTEDVALUE('Table 2'[Date])
return
IF(
MAX('Table'[INVOICE_DATE])=MINX(FILTER(ALL('Table'),'Table'[CUSTOMER_ID]=MAX('Table'[CUSTOMER_ID])),[INVOICE_DATE])
&&
MAX('Table'[INVOICE_ID])=MINX(FILTER(ALL('Table'),'Table'[CUSTOMER_ID]=MAX('Table'[CUSTOMER_ID])),[INVOICE_ID])
,
MAX('Table'[REMAINING_BALANCE]),
IF(
MAX('Table'[PAYMENT_DATE])=BLANK()&&MAX('Table'[INVOICE_ID])<>MINX(FILTER(ALL('Table'),'Table'[CUSTOMER_ID]=MAX('Table'[CUSTOMER_ID])),[INVOICE_ID]),BLANK(),
IF(
MAX('Table'[PAYMENT_DATE])<=_select,MAX('Table'[REMAINING_BALANCE]),BLANK())
))Sum_All =
SUMX(
ALL('Table'),[Flag])
3. Result:
[Invoice_id]=101 is also during slicer filtering, so it is also added
Best Regards,
Liu Yang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly