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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
TheSweeper
Helper I
Helper I

Help with Formula for Days in AR

Hello!  Good Afternoon.  I am needing some help with a formula for showing casing the # of Days in AR.  Below you will find all the formulas I used inside of my report.  I also have provided several screenshots.  I am not sure what I am doing wrong.  Please help!!!!  My teammates are getting frustrated with me. 😞 I can't figure it out. 

Thank you so much in advance!

Sincerely,

Amanda 

 

Last 6 Month Charges = 1,689,901.39

How I got the Last 6 Month Charges is by using the Date (relative date) filter.

I also had a formula called IsLatest  ..that is a True / False statement set up to only sum charges by latest modified date so it wouldn't be adding up duplicate values.

TheSweeper_0-1668631997570.png

 

Count of Days in Last 6 Months = 184

I used my Calendar Table and chose the column “Days in Month.” I then used the Date Filter to only count the days in the last 6 months. 

TheSweeper_1-1668631997584.png

 

Average Charges in Last 6 Months = 8,966.86

I then set up a measure to calculate the Average Charges by dividing the Last 6 months charges by the # number of days in last 6 months.

I also applied the date filter for the last 6 months.

DAX FORMULA USED: Avg Charges = DIVIDE([Last 6 month Charges], COUNT(_Calendar[Days in Month]),0)

TheSweeper_2-1668631997593.png

 

Total AR = 593,560.15

I just used my Charges Table and Chose "Balance"

 

Total AR Days = 66 ($ 59, 3560.15 Total AR / $ 8,966.86 Average Charge in last 6 months)

*****When setting up this formula I get the following value = 45

Using dax formula = 

AR Days = DIVIDE([Total Balance],[Avg Charges], 0)

TheSweeper_3-1668631997607.png

 

1 ACCEPTED SOLUTION
TheSweeper
Helper I
Helper I

Hello!  

Yes.  When you divide " $593,560.15" / "$ 8,966.86"  the answer is "66." In BI, when I using the below formula it gives me 45.  I am using the following formula:

AR Days = DIVIDE([Total Balance], [Avg Charges], 0)  *Using the following Filter Date: (Relative Date is in last 6 months)

 

Here are the other forumula I used:

1. Total Balance = SUM(Charges[Balance])

........Total Balance (which is also known as "Total AR")

 

2.  Last 6 month ChargesCALCULATE([Total Charges], DATESINPERIOD(_Calendar[Date], MAX(_Calendar[Date]), -184, DAY))  ....I didn't know how to go back 6 months so I just used "184" days.  I know sometimes it may not be 184 days but at least I got something in the meantime.  *Using the following Filter Date: (Relative Date is in last 6 months)

 

3.  Avg Charges = DIVIDE([Last 6 month Charges], COUNT(_Calendar[Days in Month]),0)

*Using the following Filter Date: (Relative Date is in last 6 months)

 

Hope this helps 

View solution in original post

2 REPLIES 2
TheSweeper
Helper I
Helper I

Hello!  

Yes.  When you divide " $593,560.15" / "$ 8,966.86"  the answer is "66." In BI, when I using the below formula it gives me 45.  I am using the following formula:

AR Days = DIVIDE([Total Balance], [Avg Charges], 0)  *Using the following Filter Date: (Relative Date is in last 6 months)

 

Here are the other forumula I used:

1. Total Balance = SUM(Charges[Balance])

........Total Balance (which is also known as "Total AR")

 

2.  Last 6 month ChargesCALCULATE([Total Charges], DATESINPERIOD(_Calendar[Date], MAX(_Calendar[Date]), -184, DAY))  ....I didn't know how to go back 6 months so I just used "184" days.  I know sometimes it may not be 184 days but at least I got something in the meantime.  *Using the following Filter Date: (Relative Date is in last 6 months)

 

3.  Avg Charges = DIVIDE([Last 6 month Charges], COUNT(_Calendar[Days in Month]),0)

*Using the following Filter Date: (Relative Date is in last 6 months)

 

Hope this helps 

djurecicK2
Super User
Super User

Hi @TheSweeper ,

 Could you possibly post an example of the end result you are looking for?

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.