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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
PriyankaA905
Frequent Visitor

Cumulative Daily Average Balance

Hi

In below table, How can we calculate No of Days and CDAB calculation in Power BI

For Eg as on 31-May-22
SUM_Balance_FY_MONTH = SUM of balance from 1 April 2022, i.e FY 2022-2023, 3687
No of days= NO of days from Finanicial year i.e from 1April 2022 to 31-May-22 ,61
CDAB = Sum_Balance_FY_Month/No of days

 

AS_ON_DATEBALANCESUM_BALANCE _FY_MONTHNo of DaysCDAB
1-Apr-223263261326
2-Apr-222405662283
3-Apr-2243410003333
4-Apr-2230913094327
5-Apr-2220015095302
6-Apr-2237818876315
30-Apr-2260024873082.9
31-May-22120036876160.4
1 ACCEPTED SOLUTION
d_gosbell
Super User
Super User

You could do the CDAB calculation in a single expression like the following:

CDAB =
var _maxDate = max('Table'[AS_ON_DATE])
var _minDate = calculate(min('Table'[AS_ON_DATE]), all('Table'[AS_ON_DATE]))
var _days = DATEDIFF(_minDate, _maxDate, DAY) + 1
return divide( SUMX( FILTER(all('Table'[AS_ON_DATE],'Table'[BALANCE]), 'Table'[AS_ON_DATE] <= _maxDate), 'Table'[BALANCE]), _days)

View solution in original post

2 REPLIES 2
PriyankaA905
Frequent Visitor

Thanks!!It worked

d_gosbell
Super User
Super User

You could do the CDAB calculation in a single expression like the following:

CDAB =
var _maxDate = max('Table'[AS_ON_DATE])
var _minDate = calculate(min('Table'[AS_ON_DATE]), all('Table'[AS_ON_DATE]))
var _days = DATEDIFF(_minDate, _maxDate, DAY) + 1
return divide( SUMX( FILTER(all('Table'[AS_ON_DATE],'Table'[BALANCE]), 'Table'[AS_ON_DATE] <= _maxDate), 'Table'[BALANCE]), _days)

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!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.