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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
YeldarR
Frequent Visitor

Make a total for maxx values (Balance sheet)

Hello, community. I've created Balance Sheet with the following formula:
Return actual balance =
VAR maxDate = MAX('BS_actuals'[date_key])

RETURN
MAXX(FILTER(BS_actuals,[date_key]=maxDate),[value])
 
This way, when choosing a range of dates, it didn't sum up all the balances, but returned the balance for the latest date of selected dates range. That worked for 1 level of balances. However, when I add the level above (grand level), it doesn't sum up but get the maxx amount for the entire level.
YeldarR_0-1642655738867.png

I've checked similar topic, but couldn't do the same for my case. Please help.

1 ACCEPTED SOLUTION

@YeldarR , Try like

 

Return actual balance =
VAR maxDate = MAXX(allselected('BS_actuals') , 'BS_actuals'[date_key])

RETURN
SUMX(FILTER(BS_actuals,[date_key]=maxDate),[value])

 

or

 

 

Return actual balance =
VAR maxDate = MAXX(allselected('BS_actuals') , 'BS_actuals'[date_key])

RETURN
SUMX(values(BS_actuals[Level1]), calculate( MAXX(FILTER(BS_actuals,[date_key]=maxDate),[value]) ) )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

4 REPLIES 4
amitchandak
Super User
Super User

@YeldarR , Try like

 

Return actual balance =
VAR maxDate = MAXX(allselected('BS_actuals') , 'BS_actuals'[date_key])

RETURN
MAXX(FILTER(BS_actuals,[date_key]=maxDate),[value])

 

 

If this does not help
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you. Nope doesn't work. It works only for level1 layout, but level2 layout show maxx instead of sum.

BS actuals goes the following:

YeldarR_0-1642658820962.png

 

BS layout:

YeldarR_1-1642658820891.png

 

 

@YeldarR , Try like

 

Return actual balance =
VAR maxDate = MAXX(allselected('BS_actuals') , 'BS_actuals'[date_key])

RETURN
SUMX(FILTER(BS_actuals,[date_key]=maxDate),[value])

 

or

 

 

Return actual balance =
VAR maxDate = MAXX(allselected('BS_actuals') , 'BS_actuals'[date_key])

RETURN
SUMX(values(BS_actuals[Level1]), calculate( MAXX(FILTER(BS_actuals,[date_key]=maxDate),[value]) ) )

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Thank you!

First one is correct.

Everyone who complies balance sheet, must use this command to get balances correct:

Return actual balance =
VAR maxDate = MAXX(allselected('BS_actuals') , 'BS_actuals'[date_key])

RETURN
SUMX(FILTER(BS_actuals,[date_key]=maxDate),[value])

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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

Top Solution Authors
Top Kudoed Authors