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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
TylerSimpson
Frequent Visitor

IF Date is Null 0 else 1 but add USERELATIONSHIP (2 date fields used)

I have the below Model.

snip_021323_1.PNG

In the 'App List' table there are 2 dates 'Application Date' and 'Fund Date'. If an application goes in 02/10/2023 and is funded 02/13/2023 those will be the dates.

I wanted to create a filter for 'funded' and 'not funded'.

I did this by creating the 'Funded' column in 'App List' as you can see below.

 

Funded = 
IF(
    ISBLANK('App List'[Fund Date]), 
    "Not Funded", 
    "Funded"
)

 


My problem is that this relationship defaults to the 'Application Date' to 'DateKey.Date' and I cannot get the USERELATIONSHIP function to work as I have done previously. This throws off all of my time based statistics. IE if I say apps funded in the last 3 months it goes back to the application date of the app which cuts off a few days.


Here is an example of using this relationship on a different field:

 

funded_count = CALCULATE(COUNT('App List'[Fund Date])
    ,USERELATIONSHIP( DateKey[Date], 'App List'[Fund Date]))

 



I have tried many different options but to save space I will only include a few:

 

Funded =
CALCULATE(
IF(
ISBLANK(MIN('App List'[Fund Date])),
"Not Funded",
"Funded"
),
USERELATIONSHIP(DateKey[Date], 'App List'[Fund Date])
)

Funded =
IF(
ISBLANK('App List'[Fund Date]),
"Not Funded",
IF(
USERELATIONSHIP(DateKey[Date], 'App List'[Fund Date]),
"Funded",
"Not Funded"
)
)

 


I am open to a completely different approach as my goal is simply to create a checkbox.

Here is a snippet of the table contents. There are many fields that are blank unless the app is funded as you can see.

snip_021323_2.PNGsnip_021323_3.PNG

1 REPLY 1
sevenhills
Super User
Super User

Try this, I think you had formula correct except the minor change:

 

 

funded_count = CALCULATE(COUNT('App List'[Fund Date])
    ,USERELATIONSHIP( 'App List'[Fund Date], DateKey[Date] ))

 

 

Check this one: 

https://www.sqlbi.com/articles/userelationship-in-calculated-columns/

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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