Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon'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.
I have a dataset that shows different Railcars moving across different routes and is captured line by line by what segement it is on. I am wanting to create a couple columns that show the Origin City that the move started, the interchange locations and the Destination City Regardless of the segment it is on.
I want to show LAKOTA is the Begin City on all segments because it has the lowest segement no and BLISSFIEL the End City on all segments because it has the highest segment no. I am also not sure if there is a way to show Chicago as Interchange 1, Lima as Interchange 2 and Riga as Interchange 3 on all lines as well. Any help would be greatly appreciated!
Example below:
Solved! Go to Solution.
@DerekC Well, in your case you may not need something as fancy as Transitive Closure. You could do this in DAX columns or probably PQ columns as well. Let's see, in DAX it would be something like this:
Begin City Column =
VAR __CarNo = [car_no]
VAR __Table = FILTER('Table',[car_no] __CarNo)
VAR __Segment = MINX(__Table,[segment_no)
RETURN
MAXX(FILTER(__Table,[segment_no] = __Segment),[Begin City])
End City Column =
VAR __CarNo = [car_no]
VAR __Table = FILTER('Table',[car_no] __CarNo)
VAR __Segment = MAXX(__Table,[segment_no)
RETURN
MAXX(FILTER(__Table,[segment_no] = __Segment),[End City])
@DerekC I feel like I did this once, I think it is something called Transitive Closure: Transitive Closure - Microsoft Power BI Community
@Greg_Deckler This is close, but "FROM" being the Begin City and "END" being the End City doesn't always give me the 1st Begin City from the minimun segment like I am looking for. Is there a bit more context that can be applied?
@DerekC Well, in your case you may not need something as fancy as Transitive Closure. You could do this in DAX columns or probably PQ columns as well. Let's see, in DAX it would be something like this:
Begin City Column =
VAR __CarNo = [car_no]
VAR __Table = FILTER('Table',[car_no] __CarNo)
VAR __Segment = MINX(__Table,[segment_no)
RETURN
MAXX(FILTER(__Table,[segment_no] = __Segment),[Begin City])
End City Column =
VAR __CarNo = [car_no]
VAR __Table = FILTER('Table',[car_no] __CarNo)
VAR __Segment = MAXX(__Table,[segment_no)
RETURN
MAXX(FILTER(__Table,[segment_no] = __Segment),[End City])
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
104 | |
69 | |
48 | |
41 | |
34 |
User | Count |
---|---|
164 | |
112 | |
62 | |
54 | |
38 |