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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Irwin
Helper IV
Helper IV

Related + userelationship ?

Hi Guys,

I need to create a calculated column with userelatioship.

So far I have made a monthyear column with related refering to my date table.

Irwin_0-1643966584348.png

 

This works fine and the date is displayed from the "deadline" of the task:

Irwin_1-1643966627799.png   Irwin_2-1643966637879.png

I do however have a secondary date. "Start date". I need to create another "monthyear-Startdate"  column.

So far I have tried with this measure... but the column is just empty?

 

MonthStartDate = LOOKUPVALUE(DimCalendar[MonthYearKey], DimCalendar[CalendarKey], 'TaskTable'[Start Date])

Irwin_4-1643966746328.png

 

Why? Any help is appreciated 🙂

 

1 ACCEPTED SOLUTION
Irwin
Helper IV
Helper IV

Okay I managed to solve it with this article:

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

 

Its long and complicated... I didnt understand everything but once I used their measure it worked.

 

MonthStartDate =
CALCULATE (
SELECTEDVALUE ( DimCalendar[MonthYearKey] ),
CALCULATETABLE(
'TaskTable(Lots)',
USERELATIONSHIP ( 'TaskTable(Lots)'[Start Date], 'DimCalendar'[CalendarKey] ),
REMOVEFILTERS('DimCalendar')
)
)
 
Thanks for your answer amitchandak, I will definately try it out as well.

View solution in original post

3 REPLIES 3
Irwin
Helper IV
Helper IV

Okay I managed to solve it with this article:

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

 

Its long and complicated... I didnt understand everything but once I used their measure it worked.

 

MonthStartDate =
CALCULATE (
SELECTEDVALUE ( DimCalendar[MonthYearKey] ),
CALCULATETABLE(
'TaskTable(Lots)',
USERELATIONSHIP ( 'TaskTable(Lots)'[Start Date], 'DimCalendar'[CalendarKey] ),
REMOVEFILTERS('DimCalendar')
)
)
 
Thanks for your answer amitchandak, I will definately try it out as well.
amitchandak
Super User
Super User

@Irwin , hope Start Date does not have timestamp

Try a new column like

MAxx(filter(DimCalendar,DimCalendar[CalendarKey] = datevalues( 'TaskTable'[Start Date]) ) , DimCalendar[MonthYearKey])

Hi again,

 

Unfortunately I could not get your formula to work. It just returns a blank value. Thank you very much for helping 🙂

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.