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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
Syndicate_Admin
Administrator
Administrator

USEREALTIONSHIP convert to date in VAR

Hello everyone

I have a calendar table date column that I'm trying to connect to my main table with an arrival date column. However, the arrival date is in date and time format.

The question is: How can I convert the arrival date to use userelationship in my measure without creating a new date-only column?

1 ACCEPTED SOLUTION
v-yohua-msft
Community Support
Community Support

Hi, @Syndicate_Admin 

Thanks for the reply from @PhilipTreacy .

I create a sample table:

vyohuamsft_0-1716192708366.png

vyohuamsft_1-1716192740808.png

First, create an inactive relationship between the two tables.

vyohuamsft_2-1716192937030.png

 

Then create a DAX measure, and use the USEREALTIONSHIP function to specify the inactive relationship.

ShipDate_RM3 = CALCULATE(
    SUM('Table'[Quantity]),
    USERELATIONSHIP('Date'[Date], 'Table'[Arrival Date]),
    FILTER('Table', 'Table'[Source] = "RM3")
)

Here is my preview:

vyohuamsft_3-1716193005120.png

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-yohua-msft
Community Support
Community Support

Hi, @Syndicate_Admin 

Thanks for the reply from @PhilipTreacy .

I create a sample table:

vyohuamsft_0-1716192708366.png

vyohuamsft_1-1716192740808.png

First, create an inactive relationship between the two tables.

vyohuamsft_2-1716192937030.png

 

Then create a DAX measure, and use the USEREALTIONSHIP function to specify the inactive relationship.

ShipDate_RM3 = CALCULATE(
    SUM('Table'[Quantity]),
    USERELATIONSHIP('Date'[Date], 'Table'[Arrival Date]),
    FILTER('Table', 'Table'[Source] = "RM3")
)

Here is my preview:

vyohuamsft_3-1716193005120.png

How to Get Your Question Answered Quickly 

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

PhilipTreacy
Super User
Super User

Hi @Syndicate_Admin  @golire 

 

What exactly are you trying to do?

 

You don't need to create a new date column from the date/time to use it in measures.  You could just use functions like YEAR, MONTH and DAY with DATE to create a date.

 

The answer depends on what it is you want to do.

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

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