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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
AlanRGroskreutz
Helper II
Helper II

table of paths and locations that go through a given point

Hey y'all,

I am trying to create a virtual table that will be a subset of a datatable (3PointPlans).  This table contains the locations along paths of various flights.  Each path(cfmuflightkey) inlcudes locations, each with a pointname, a latitude and longitude, and a sequence number. A sample of the datatable is given here.

cfmuflightkeypointnamelatlonsequenceNumber
54937201NILDU42.26033.8286159
54937201TEBLA41.38122.325176
54937201TUPOX43.97585.4030652
54937203KORIS35.8333-6.2391726
54937203MAR37.0553-4.939934
54937203VAGNO35.74-6.325
54937204ABRON42.61428.1477829
54937204LEMG36.6871-4.5124774
54937204TOSGA37.6257-2.3073643
54937205FAFEQ40.1694-3.460765
54937205OLGUD50.7322-1.5227826
54937205VADOX43.7667-3.9327837

 

What I want to do is to maintain the same columns, but to filter it to where it inlcudes all the pointnames, locations, sequence numbers of paths that go through a given point name.

In other words, not just filter the pointname column for the given pointname, but the other points that any path that would go through it would include.

Here is an example of what I'm looking to achieve for the given pointname LUXUR

cfmuflightkeypointnamelatlonsequenceNumber
54943084ARMED42.5-142
54943084BARDI40.5835-6.302464
54943084LUXUR38.21333.421943
54943084PAGRE37.7155
54943129ARMED42.5-141
54943129BARDI40.5835-6.302462
54943129LUXUR38.21333.421943
54943129PAGRE37.7154
54943139ARMED42.5-1494
54943139BARDI40.5835-6.3024695
54943139LUXUR38.21333.4219496
54943139PAGRE37.71597


I can get the list of the distinct CFMUflightkey values that I want, but how to then virtually re-construct the table filtered as I want it is proving to be a blocking point.  I think I need to use either SUMMARIZE, SUMMARIZECOLUMS, or something along those lines, but I just don't know how to construct it.  I have a variable for the shortened list of CFMUflightkeys, which is 

VAR FlightList =
SELECTCOLUMNS(
    FILTER('3PointPlans',
    '3PointPlans'[pointname]=Selectedpoint),
'3PointPlans'[cfmuflightkey]
)
the variable "Selectedpoint" in the example case would have the value LUXUR.

I just don't know how to use this list to filter the table again to get what I showed as the example.
1 ACCEPTED SOLUTION
SamWiseOwl
Super User
Super User

Hi @AlanRGroskreutz 

Is it something like this?

SamWiseOwl_0-1724242842747.png

In flight =
var sel = SELECTEDVALUE(Choose[Flight path])--capture flight
var flightList =
CALCULATETABLE(--return list of unqiue locations
    VALUES('3PointPlans'[cfmuflightkey])
    ,all('3PointPlans')--remove any filters
    ,'3PointPlans'[pointname] = sel--filter to selected flight
)

RETURN --if current item in the list 0 otherwise 1
if( SELECTEDVALUE('3PointPlans'[cfmuflightkey]) IN flightList
,1,0)

If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

View solution in original post

2 REPLIES 2
AlanRGroskreutz
Helper II
Helper II

I think that will work for me, thanks.

SamWiseOwl
Super User
Super User

Hi @AlanRGroskreutz 

Is it something like this?

SamWiseOwl_0-1724242842747.png

In flight =
var sel = SELECTEDVALUE(Choose[Flight path])--capture flight
var flightList =
CALCULATETABLE(--return list of unqiue locations
    VALUES('3PointPlans'[cfmuflightkey])
    ,all('3PointPlans')--remove any filters
    ,'3PointPlans'[pointname] = sel--filter to selected flight
)

RETURN --if current item in the list 0 otherwise 1
if( SELECTEDVALUE('3PointPlans'[cfmuflightkey]) IN flightList
,1,0)

If you are happy with this answer please mark as a solution for others to find !

Kudos are always appreciated! Check out our free Power BI video courses.

Helpful resources

Announcements
May PBI 25 Carousel

Power BI Monthly Update - May 2025

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

May 2025 Monthly Update

Fabric Community Update - May 2025

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