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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
CracktheCode85
Helper II
Helper II

DAX Date Filters based on two date columns

Hi Brilliant folks! 

 

I'm having trouble determining a correct conditional filter for two date filters for an Outstanding Balance: 

The two Date columns are:

1.) Month End Dates (April 30, May 31 etc...)

2.) Due Dates ; Ranges from 2020 to December 2024. 

 

Im working on a formula that calculates the Previous Months Outstanding Balance based on the following criteria:

The Due Date is less than or equal to the Current Month. 

 

My question is how do I accurately capture this criteria with two date fields? 

 

VAR current_month = [Current Month]
RETURN
CALCULATE([Prior_Outstanding], 'Table'[Month & Year (Due_Date)] <= current_month)
2 REPLIES 2
amitchandak
Super User
Super User

@CracktheCode85 ,

Prefer a date table, assuming current month coming from selection of today

 

Current Month = if(isfiltered('Date'), Max('Date'[Date]), today())

 

 

Last month end date =

VAR current_month = eomonth([Current Month],-1)
RETURN
CALCULATE([Prior_Outstanding], filter( all ('Date'), Date'[Date] = current_month)
 
In case date and the table is not joined you can tables columns.
 
You can also use closingbalancemonth
 
Power BI closingbalancemonth closingbalancequarter closingbalanceyear, lastnonblankvalue- Closing Balance, Distibutre Target: https://youtu.be/yPQ9UV37LOU
 
Why previousmonth does not give result when datesmtd is giving it: https://youtu.be/1KkoJehRVeg
 
Why Time Intelligence Fails - Powerbi 5 Savior Steps for TI :https://youtu.be/OBf0rjpp5Hw
https://amitchandak.medium.com/power-bi-5-key-points-to-make-time-intelligence-successful-bd52912a5b...
To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Is it sandard practice to create a custom calendar for each dashboard build?

Can I create a filter that says something like this:
Date (04/05/2024) is less than or equal to Age Date (Current Month-End).
These have two different data types so I don't think BI will agree with the logic I'm trying to make happen. 

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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