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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
Deelip
Resolver I
Resolver I

Dynamic calculations based on the selected date

Hi All, 

I cannot think of an approach for my requirement on finding the outstanding amounts/number of days due based on the user selection.

 

I have the following table and with the expected output. Lets say if a user selects October 22nd 2024, I would like to have the total AR outstanding amount for the invoices where [closed at Date] is blank and also [closed at date] is greater than the user selected date. 

In the scenario below if we select a date as oct 22nd 2024; I am getting total amount based on rows where the closed at date is blank and closed at date is greater than oct 22nd 2024. 

 [not due] is something where my due date greater than date selected on the filter.

 [1-30] days is calculated based on the number of days between the [due date] to selected date on the filter.  

 

If you have any thought process on how to approach this kind of problem statement please share. Thanks!

Deelip_0-1731516531988.png

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@Deelip 

you can try this

 

Total AR =
VAR _date=max('date'[Date])
return sumx(FILTER(all('Table'),'Table'[Customer]=max('Table'[Customer])&&('Table'[Closed at Date]>_date||ISBLANK('Table'[Closed at Date]))),'Table'[Amount])
 
not due =
VAR _date=max('date'[Date])
return sumx(FILTER(all('Table'),'Table'[Customer]=max('Table'[Customer])&&'Table'[Due Date]>_date),'Table'[Amount])
 
1-30days =
VAR _date=max('date'[Date])
VAR _tbl=ADDCOLUMNS('Table',"days",'Table'[Closed at Date]-_date)
return sumx(FILTER(_tbl,'Table'[Customer]=max('Table'[Customer])&&[days]>0 &&[days]<=30),'Table'[Amount])
 
 
 11.PNG
 
pls see the attachment below




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

3 REPLIES 3
ryan_mayu
Super User
Super User

@Deelip 

you can try this

 

Total AR =
VAR _date=max('date'[Date])
return sumx(FILTER(all('Table'),'Table'[Customer]=max('Table'[Customer])&&('Table'[Closed at Date]>_date||ISBLANK('Table'[Closed at Date]))),'Table'[Amount])
 
not due =
VAR _date=max('date'[Date])
return sumx(FILTER(all('Table'),'Table'[Customer]=max('Table'[Customer])&&'Table'[Due Date]>_date),'Table'[Amount])
 
1-30days =
VAR _date=max('date'[Date])
VAR _tbl=ADDCOLUMNS('Table',"days",'Table'[Closed at Date]-_date)
return sumx(FILTER(_tbl,'Table'[Customer]=max('Table'[Customer])&&[days]>0 &&[days]<=30),'Table'[Amount])
 
 
 11.PNG
 
pls see the attachment below




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@ryan_mayu 

 

Thank you so much. It worked as expected. Appreciate your help.

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 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.

Top Solution Authors
Top Kudoed Authors