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

Learn from the best! Meet the four finalists headed to the FINALS of the Power BI Dataviz World Championships! Register now

Reply
waqarqtrz
Frequent Visitor

My calculated column does not seem to be correctly comparing 2 dates column?

I have a dbDates table that i created through a blank query in Power Query

I have a c177 TMO table that contains loan data

I have a date filter in my report that is in the form of a slider - you can choose the beginning and end dates.

 

I am trying to create a calculated column as follows:
 
"StartDateMeasure = MIN(dbDates[CorrectedDate])"
 
"
FILTER_PaidOffDate =
VAR StartDate = [StartDateMeasure]
RETURN
IF(
    ISBLANK(MAX('c177 TMO'[PaidOffDate])) || MAX('c177 TMO'[PaidOffDate]) >= StartDate,
    "Include",
    "Repaid Loan"
)"

However, it seems to still have paid off dates before the Start Date as "Included" instead of Repaid.
 
When I explicitly compare it against DATE(Year of MIN Start Date, Month of MIN start date etc...) it seems to do a better job.
I've double checked that both Dates I am trying to compare against ate in the the date format, and the PaidOffDate does have blanks in it since they are not paid off yet.

Sample Data:
C177 TMO:
LoanCodeTransactionDatePaidOffDateTransactionAmount

2111/24

2023-11-30

2024-01-01

$150

2111/24

2024-01-01

2024-01-01

$-24000
1994/222023-10-202023-11-20$80
1994/222023-11-202023-11-20$-10000
22222023-11-01 $250
22222024-02-25 $150

 

Then I have a standard Date table dbDates with a Date column, Day Name, Day of Month, Month Name, Month-Year etc.

Output Wanted:

IF Date filter is set between 2024-01-01 and 2024-01-31

C177 TMO:
LoanCodeTransactionDatePaidOffDateTransactionAmountFILTER_PaidOffDate

2111/24

2023-11-30

2024-01-01

$150Include

2111/24

2024-01-01

2024-01-01

$-24000Include
1994/222023-10-202023-11-20$80Repaid Loan
1994/222023-11-202023-11-20$-10000Repaid Loan
22222023-11-01 $250Include
22222024-02-25 $150Include
2 ACCEPTED SOLUTIONS
ryan_mayu
Super User
Super User

@waqarqtrz 

you can try this

 

Measure = if(max('C177 TMO'[PaidOffDate])>=min('Date'[Date])&&max('C177 TMO'[PaidOffDate])<=max('Date'[Date]),"Include","Repaire Loan")
 
11.PNG




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

Proud to be a Super User!




View solution in original post

if you want to use DAX to create a new table. The filter visual will not affect the table output.





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

Proud to be a Super User!




View solution in original post

7 REPLIES 7
ryan_mayu
Super User
Super User

@waqarqtrz 

you can try this

 

Measure = if(max('C177 TMO'[PaidOffDate])>=min('Date'[Date])&&max('C177 TMO'[PaidOffDate])<=max('Date'[Date]),"Include","Repaire Loan")
 
11.PNG




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

Proud to be a Super User!




why wouldn't this work:

FILTER_PaidOffDate =
VAR StartDate = [StartDateMeasure]
RETURN
IF(
    ISBLANK(MAX('c177 TMO'[PaidOffDate])) || MAX('c177 TMO'[PaidOffDate]) >= StartDate,
    "Include",
    "Repaid Loan"
)
If i want to also include blank PaidOffDate in the criteria as well?

if you want to use DAX to create a new table. The filter visual will not affect the table output.





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

Proud to be a Super User!




ryan_mayu
Super User
Super User

could you pls provide some sample data and expected output?





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

Proud to be a Super User!




Provided some sample data in my original question.

So you have another date table. Then what's the expected output based on the sample data you provided?





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

Proud to be a Super User!




Just realized my sample output did not get recognized - it is now included and formatted as well in a table.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

February Power BI Update Carousel

Power BI Monthly Update - February 2026

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