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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

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.

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
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.