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
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

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