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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
jsangerman
Helper II
Helper II

Calculated column to get value from another table ignoring relationship

I have two tables:

 

Milestone

Milestone TitleFinish
Start1/1/2024
Milestone12/1/2024
Milestone23/1/2024
Finish4/1/2024

 

StandardMilestone

StandardMilestoneTitleMilestoneSort
Start1
Milestone12
Finish3

 

There's a relationship between these two (StandardMilestoneTitle --> Milestone Title), though you'll notice that not every value for Milestone Title has a matching value in StandardMilestone. I want to add a column to Milestone with the MilestoneSort value for the row in StandardMilestone where Title = "Start." In other words:

 

Milestone TitleFinishStartSort
Start1/1/20241
Milestone12/1/20241
Milestone23/1/20241
Finish4/1/20241

 

What I'm getting is this, where only the row in Milestone where Title = Start gets the calculation:

Milestone TitleFinishStartSort
Start1/1/20241
Milestone12/1/2024 
Milestone23/1/2024 
Finish4/1/2024 

 

Here's my formula:

CALCULATE( MIN( 'StandardMilestone'[MilestoneSort] ), FILTER( ALL('StandardMilestone'), 'StandardMilestone'[StandardMilestoneTitle] = "Start") )
 
Where are my DAX skills failing me?
2 REPLIES 2
Greg_Deckler
Super User
Super User

@jsangerman I can't seem to replicate this. See attached PBIX below signature.

 



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Power BI Cookbook Third Edition (Color)

DAX is easy, CALCULATE makes DAX hard...

Turns out I had the relationship cross-filter going in both directions. When I switch it to one direction, it works as expected.

 

However, when I tried the same thing on your example, it didn't work the same. The calculated column works as expected no matter the cross-filter direction. There's actually one difference I hadn't thought of, but is causing the changing behavior. My StandardMilestone table actually looks like this:

 

StandardMilestone

StandardMilestoneTitleMilestoneTitleMilestoneSort
StandardStartStart1
StandardMilestone1Milestone12
StandardFinishFinish3

 

The relationship is MilestoneTitle --> Milestone Title, and the column formula is:

 

CALCULATE( MIN( 'StandardMilestone'[MilestoneSort] ), FILTER( ALL('StandardMilestone'), 'StandardMilestone'[StandardMilestoneTitle] = "StandardStart") )

 

I redid your file to match this:  Milestones.pbix

 

Can you explain why it doesn't work when the cross-filtering goes in both directions?

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.