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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
rajasekaro
Helper III
Helper III

Closing value

Hi team , 
how to calculate closing value 
i have account data 

ACCOUNTAPYCDATEAMOUNT
4306048272780030-04-2024-360868242
4306048272780031-05-2024-92756178
4306048272780030-06-20247020311
4306048272780031-07-2024107432449
4306048272780031-08-202479516473
4306048272780030-09-2024-28624685
4306048272780031-10-2024-51472204
4306048272780030-11-2024101618069
4306048272780031-12-2024-864144
4306048272780031-01-2025-14221816
4306048272780028-02-2025-12359813
4306048272780031-03-202525600331

 

 

Expected Out put 

ACCOUNTAPYCDATEAMOUNTClosing
4306048272780030-04-2024-360868242121859558
4306048272780031-05-2024-9275617829103380
4306048272780030-06-2024702031136123691
4306048272780031-07-2024107432449143556140
4306048272780031-08-202479516473223072613
4306048272780030-09-2024-28624685194447928
4306048272780031-10-2024-51472204142975724
4306048272780030-11-2024101618069244593793
4306048272780031-12-2024-864144243729649
4306048272780031-01-2025-14221816229507833
4306048272780028-02-2025-12359813217148020
4306048272780031-03-202525600331242748351

 

2 ACCEPTED SOLUTIONS
Lodha_Jaydeep
Solution Sage
Solution Sage

Hi @rajasekaro,
Please have a look at the below solution.

1) Create power Bi measures for the closing

ClosingV3 = 
VAR Opening = MAX(account_transactions[APYC])
VAR CurrentDate = MAX(account_transactions[DATE])
VAR CurrentAccount = MAX(account_transactions[ACCOUNT])
VAR CumulativeAmount =
    CALCULATE(
        SUM(account_transactions[AMOUNT]),
        REMOVEFILTERS(account_transactions),
        account_transactions[ACCOUNT] = CurrentAccount,
        account_transactions[DATE] <= CurrentDate
    )
RETURN
Opening + CumulativeAmount

OR

Closing_v4 = 
VAR Opening = MAX(account_transactions[APYC])
RETURN
Opening +
CALCULATE(
    SUM(account_transactions[AMOUNT]),
    ALLEXCEPT(account_transactions, account_transactions[ACCOUNT]),
    account_transactions[DATE] <= MAX(account_transactions[DATE])
)

 2) Copy that measure in the table/matrix visual

Lodha_Jaydeep_0-1780315283244.png

 

Please consider as an accepted solution if worked or give some kudod.

View solution in original post

ryan_mayu
Super User
Super User

@rajasekaro 

if you want to create a column ,you can try this

Column = 'Table'[APYC]+sumx(FILTER('Table','Table'[ACCOUNT]=EARLIER('Table'[ACCOUNT])&&'Table'[DATE]<=EARLIER('Table'[DATE])),'Table'[AMOUNT])
 
11.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

7 REPLIES 7
parry2k
Super User
Super User

@rajasekaro sorry to add another solution here, everyone else has done great work but I disagree with above solutions. Anything related to time intelligence should be handles using calendar/date table (as a best practice).  Learn more about that, check here:

 

As a best practice, add a date dimension in your model and use it for time intelligence calculations. Once the date dimension is added, mark it as a date table on table tools. Check the related videos on my YT channel

 

Add Date Dimension
Importance of Date Dimension
Mark date dimension as a date table - why and how?
Time Intelligence Playlist


I will create a date dimension and use this to work with dates, and setup relationship of this table with the transaction/fact table on the date column.

Sum Amount = SUM ( Table2[AMOUNT] )  --just a base measure

RT Amount = 
CALCULATE ( 
    [Sum Amount],
    FILTER ( 
        ALLSELECTED ( 'Calendar' ), --change this will all if want to ignore any filter on date
        'Calendar'[Date] <= MAX ( 'Calendar'[Date] )
    )
)

Closing Value = 
MAX ( Table2[APYC] ) + [RT Amount]


Cheers!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

ryan_mayu
Super User
Super User

@rajasekaro 

if you want to create a column ,you can try this

Column = 'Table'[APYC]+sumx(FILTER('Table','Table'[ACCOUNT]=EARLIER('Table'[ACCOUNT])&&'Table'[DATE]<=EARLIER('Table'[DATE])),'Table'[AMOUNT])
 
11.png

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




pankajnamekar25
Super User
Super User

Hello @rajasekaro 

try this 

 

Closing =
VAR CurrentDate = MAX(account_transactions[DATE])
VAR CurrentAccount = MAX(account_transactions[ACCOUNT])
VAR Opening = MAX(account_transactions[APYC])

RETURN
Opening +
CALCULATE(
SUM(account_transactions[AMOUNT]),
REMOVEFILTERS(account_transactions),
account_transactions[ACCOUNT] = CurrentAccount,
account_transactions[DATE] <= CurrentDate
)

 

 


If my response helped you, please consider clicking
Accept as Solution and giving it a Like 👍 – it helps others in the community too.

Thanks,

Connect with me on:
LinkedIn |
Data With Pankaj - YouTube
Lodha_Jaydeep
Solution Sage
Solution Sage

Hi @rajasekaro,
Please have a look at the below solution.

1) Create power Bi measures for the closing

ClosingV3 = 
VAR Opening = MAX(account_transactions[APYC])
VAR CurrentDate = MAX(account_transactions[DATE])
VAR CurrentAccount = MAX(account_transactions[ACCOUNT])
VAR CumulativeAmount =
    CALCULATE(
        SUM(account_transactions[AMOUNT]),
        REMOVEFILTERS(account_transactions),
        account_transactions[ACCOUNT] = CurrentAccount,
        account_transactions[DATE] <= CurrentDate
    )
RETURN
Opening + CumulativeAmount

OR

Closing_v4 = 
VAR Opening = MAX(account_transactions[APYC])
RETURN
Opening +
CALCULATE(
    SUM(account_transactions[AMOUNT]),
    ALLEXCEPT(account_transactions, account_transactions[ACCOUNT]),
    account_transactions[DATE] <= MAX(account_transactions[DATE])
)

 2) Copy that measure in the table/matrix visual

Lodha_Jaydeep_0-1780315283244.png

 

Please consider as an accepted solution if worked or give some kudod.

Hi @rajasekaro ,

Thank you for reaching out to the Microsoft Community Forum. could you please try the proposed solution shared by @Lodha_Jaydeep ? Let us know if you’re still facing the same issue we’ll be happy to assist you further.

 

Regards,

Dinesh

Hi @rajasekaro ,

We haven’t heard from you on the last response and was just checking back to see if you have a resolution yet. And, if you have any further query do let us know.

 

Regards,

Dinesh

DanieleUgoCopp
Super User
Super User

Hello,
I think like this

Closing =
VAR CurrentDate = 'Table'[DATE]
VAR OpeningBalance = 'Table'[APYC]
VAR RunningAmount =
CALCULATE(
SUM('Table'[AMOUNT]),
FILTER(
ALLEXCEPT('Table', 'Table'[ACCOUNT], 'Table'[APYC]),
'Table'[DATE] <= CurrentDate
)
)
RETURN
OpeningBalance + RunningAmount

kind regards,
Daniele

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors