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

Next up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now

Reply
vkboddapati
Frequent Visitor

Calculation of Age (Credit days) flag based on last 6 months sales and Ledger Closing Balance

Hello Geeks,
This was done in Excel, Kindly help to calculate and replicate this in Power BI.
I have a list of 'Area', 'Sub-Area', 'Distributor', 'Sub-Distributor', and 'Customer Name' fields against which I have month-wise sales figures (columns D to I) and 'Closing Ledger Balance' (Column J).

vkboddapati_0-1657775976361.png

I want to compute the 'Credit Days' based on 'Closing Ledger Balance' (Column J) and sales figures (columns D to I). In excel the formula is straight forward as below: 
=IF(J3<=1000,0,IF(J3<=I3+100,J3/I3*30,IF(J3<=I3+H3+100,30+(J3-I3)/H3*30,IF(J3<=I3+H3+G3+100,60+(J3-I3-H3)/G3*30,IF(J3<=I3+H3+G3+F3+100,90+(J3-I3-H3-G3)/F3*30,IF(J3<=I3+H3+G3+F3+E3+100,120+(J3-I3-H3-G3-F3)/E3*30,IF(J3<=I3+H3+G3+F3+E3+D3+100,150+(J3-I3-H3-G3-F3-E3)/D3*30,"Above 180 days")))))))

Based on computed 'Credit Days', I woluld distribute it into respective ageing bracket (as shown in the pic/file).

Below is the link to excel file,Kindly help on how to replicate this in to power BI.

https://docs.google.com/spreadsheets/d/1T5AftzkiRCzD2NcZvZMqWTcgsk9nCS-t/edit?usp=sharing&ouid=10908... 

Cheers!

VKB

4 REPLIES 4
vkboddapati
Frequent Visitor

Thanks, @lbendlin @Ashish_Mathur for your replies and understanding.
I am desperately trying to do this in Power BI. 
Kindly suggest if there are any options to make changes at the source level too.

Thanks again! adding back @Greg_Deckler @Anonymous too

lbendlin
Super User
Super User

Keep doing this in Excel.

😂Not expected that in the community! @lbendlin 

Copying the Masters of the Game 👇

@Greg_Deckler @v-shex-msft  @Ashish_Mathur @amitchandak 

Hi,

Even in MS Excel, this is not an easy calculation - let alone doing it in PBI Desktop.  I had blogged about my solution to this problem 12 years ago.  See this article - Compute Debtor days.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.