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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Justas
Advocate I
Advocate I

Opening balance problem in January month calculating retained earnings

I have 3 dax measures in balance sheet calculating Retained earnings of the current year:

1) Opening balance Retained earnings

2) Turnover (increase/decrease) Retained earnings of selected month

3) Closing balanse Retained earnings

 

For Opening balance I use YTD formula -1 period

CALCULATE([Pelnas prieš mokesčius YTD],DATEADD(Kalendorius[Data],-1,MONTH),KEEPFILTERS(F_B[F/B1]="F"))
 
For Closing balance I use just YTD formula 
CALCULATE([Pelnas prieš mokesčius],DATESYTD(Kalendorius[Data],"12-31"),KEEPFILTERS(F_B[F/B1]="F"))
 
It works perfect except January month Opening balance returns previuos year December month.
 
My problem is to write if statement, which should behave by thuther logic:
if selected value in slicer is January then return value 0 ( or Blank()) else return Retained earnings YTD - 1 period.
 
My try:
Pelnas prieš mokesčius YTD -1 Month =
Var EBTrodiklis =
CALCULATE([Pelnas prieš mokesčius YTD],DATEADD(Kalendorius[Data],-1,MONTH),KEEPFILTERS(F_B[F/B1]="F"))
Return
if(ISFILTERED(Kalendorius[Data].[Month])="1",0,EBTrodiklis) =>does not work
 
Pelnas prieš mokesčius YTD -1 Month =
Var EBTrodiklis =
CALCULATE([Pelnas prieš mokesčius YTD],DATEADD(Kalendorius[Data],-1,MONTH),KEEPFILTERS(F_B[F/B1]="F"))
Return
if(SELECTEDVALUE(Kalendorius[Data])="1",0,EBTrodiklis) =>
=>does not work
 
Pelnas prieš mokesčius YTD -1 Month =
Var EBTrodiklis =
CALCULATE([Pelnas prieš mokesčius YTD],DATEADD(Kalendorius[Data],-1,MONTH),KEEPFILTERS(F_B[F/B1]="F"))
Return
if(month( =>not allows acces to calendar table
 
Please help!
 
 
 
1 REPLY 1
amitchandak
Super User
Super User

@Justas , if the closing balance is the end of the period then you can try closingbalancemonth, closingbalancequarter,closingbalanceyear - refer https://youtu.be/yPQ9UV37LOU

 

for opening, balance refer -https://youtu.be/6lzYOXI5wfo

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.