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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
junaidch278
New Member

Opening balance from running total column

Hi there.

Thanks in advance. I am having a problem while calculating opening and closing balance on the PBI from the following table.

junaidch278_0-1686319876371.png

I have tried these 2 dax calculations but it is not reflecting the desired results.
CALCULATE
(
min(FactStockMovement[ClosingBalance]),
FILTER(
ALLSELECTED(DimDate[Date]),(DimDate[date])=min(DimDate[date])
))
CALCULATE(
min(FactStockMovement[ClosingBalance]),
FILTER(
ALLSELECTED(DimDate[Date]),(DimDate[date])=FIRSTDATE(DimDate[date])
))
Can anyone guide me how can i calculate opening and closing balance from the table.
the 1st expression is working for the values having opening and closing balance, but if there is no transaction on the min and max date we are getting null.
looking forward to hearing from you guys.
3 REPLIES 3
some_bih
Super User
Super User

Hi @junaidch278 to provide clear solution in some way, the amounts as input and output should be clear.

In general, are these inputs for amount like stock, etc cash balance or like income, etc salary.

What about wanted output?  From picture stock is wanted to be shown, like opening balance +/- inputs / outputs = ending balance, right?

Give us some example data as input and expected output per X (x could be date, product key...)





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

Proud to be a Super User!






junaidch278
New Member

HI @some_bih 
I have the requirement where user can select any date. it can be a single day or a week or a couple of months. and the solution you perposed is workable for month, quarter and year opening and closing balance.
i'm looking for a way to select dynamic minmum date so i can utilize the running totals to get the correct results.
please reach out to me if you need aditional clarity.

some_bih
Super User
Super User

Hi @junaidch278 you should probably use functions OPENING/CLOSINGBALANCE* for DAX. check link

https://www.sqlbi.com/tv/closingbalancemonth-closingbalancequarter-closingbalanceyear-dax-guide/ 





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

Proud to be a Super User!






Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors