Userelationship and Datesbetween

Hi guys,
Maybe you can help a bit with the DAX? Userelationship just doesnt work. I have Dates table with relationship to " Date Completed" and inactive one with " Date Created". Can you see anything jumping out as wrong in the below, please?
BP time to process =
CALCULATE(
COUNTROWS(Dates),
DATESBETWEEN(
Dates[Date],
USERELATIONSHIP( Workday[Date Created], Dates[Date] ),
Workday[Date Completed] ),
Dates[IsWorkday] = TRUE,
ALLSELECTED( Workday )
)

Thank you so much.

Hi @Jetuke_ES,

USERELATIONSHIP is a CALCULATE modifier.

You can list more than one filters as second argument in CALCULATE, first pass USERELATIONSHIP and separately DATESBETWEEN don’t nest the two.

Yeah, thank you, saw these articles. Was very helpful with one Userelationship,I made that work, but cant make it work with datesbetween. Can you notice anything wrong in syntax or something in my dax?

Hi @Jetuke_ES,

Think you missed this part…

BP time to process =
CALCULATE(
    COUNTROWS( Dates ),
    USERELATIONSHIP( Workday[Date Created], Dates[Date] ),
    DATESBETWEEN(
        Dates[Date],
        Workday[Date Created],
        Workday[Date Completed]
    ),
    Dates[IsWorkday] = TRUE,
    ALLSELECTED( Workday )
)
1 Like

Thank you so much for trying to help. I get this message: “A single value for column ‘Date Created’ in table ‘Workday’ cannot be determined. This can happen when a measure formula refers to a column that contains many values without specifying an aggregation such as min, max, count, or sum to get a single result.”

You are using this DAX as a calculated column in the table Workday, right?

Can you provide a small sample PBIX file? Makes it a whole lot easier for me

Omg!! :laughing: i was doing a dax measure… Column totally worked. I am sorted! Thank you so much.