cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
HarrisonCbe Member
Member

Max Date with USERELATIONSHIP

Hello, 

 

I have a problem with a measure in DAX that brings me the Max date of my Date table, a simple one MAX(DimTime[Date]), the measure works fine, but from my Fact table I have 2 relationships to the DimTime, one is active and the other one is inactive, in my Fact table the column with the active relationship is complete i doesn´t have nulls, but the one inactive has nulls values. For knowledge, I know the max date with the active relationship is '01-15-2018' but if i use the other relationship the max date is '01-14-2018', unfortunately this measure CALCULATE(MAX(DimTime[Date]),USERELANTIONSHIP(DimTime[Date],FactTable[Date2]), for reasons that I don't understand this measure show '01-15-2018' when i should be '01-14-2018'.

 

Any tips why is this happening?

 

Thanks in advanced.

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Max Date with USERELATIONSHIP

All of your measures are showing the max date in the calendar table. This has nothing to do with the fact table. If you want the max date in the fact table, then refer to the column in the fact table. 



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

3 REPLIES 3
Super User
Super User

Re: Max Date with USERELATIONSHIP

All of your measures are showing the max date in the calendar table. This has nothing to do with the fact table. If you want the max date in the fact table, then refer to the column in the fact table. 



* Matt is a Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

View solution in original post

Community Support Team
Community Support Team

Re: Max Date with USERELATIONSHIP

hi, @HarrisonCbe

You can use this formula as below:

New Unactive = CALCULATE(MAX(FactTable[Date2]),USERELATIONSHIP(DimTime[Date],FactTable[Date2]))

Result:

1.PNG

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Super User
Super User

Re: Max Date with USERELATIONSHIP

Hi,

 

Does this work?

 

=CALCULATE(MAX(FactTable[Date2]),USERELANTIONSHIP(FactTable[Date2],DimTime[Date]))

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 276 members 3,132 guests
Please welcome our newest community members: