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
Nudo
Helper I
Helper I

Using a inactive relationship in selectcolumn dax

Hey

I've created a Date Table from multiple different tables createdates that looks like this

Date Table = DISTINCT(UNION (SELECTCOLUMNS ( 'Lead', "Date", 'Lead'[CreatedDate] ),SELECTCOLUMNS ( 'Opportunity', "Date", Opportunity[CreatedDate] ),SELECTCOLUMNS ( 'Lead Instance', "Date", 'Lead Instance'[CreatedDate] ),SELECTCOLUMNS(Event,"Date",Event[CreatedDate])))

Then I create a relationship to the date table from those columns. I've noticed though these only work if the relationship is active, just wondering how can I use this and use inactive relationships. I know how I can work around this problem but I'm also curious as to if there's a solution.
3 REPLIES 3
v-jingzhang
Community Support
Community Support

Hi @Nudo

 

I recommend to use CALENDAR function to create a Date table. Its syntax is 

CALENDAR(<start_date>, <end_date>) 

You just need to give an early enough date for start_date and a late enough date for end_date then it will generate a date table which contains all dates between above two dates. Ensure that its date range is wide enough to cover all dates in your four tables. 

Date Table = CALENDAR ( DATE ( 2018, 1, 1 ), DATE ( 2022, 12, 31 ) )

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

The problem I've found using calendar is are using date times and it's only checking for date time at 12:00 and won't look at the whole day. Also I don't think that resolves my original question.

Hi @Nudo 

 

Yes, calendar function returns datetime values with timestamp 12:00 a.m. but you can change the Date column from Date/time data type to Date type to remove timestamps. 

 

Currently you are selecting CreatedDate columns from multiple tables to create a calendar table. What relationships exist between tables? What effect or output result do you want to get through those inactive relationships? Can you provide some mock data to show the expected result you want? 

 

Jing

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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