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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
patricia_csf
Regular Visitor

Select a group of users among a bigger data

Hi, 

I have a table, with 100 users that travelled 1,000 trips (10 trips on average per person).

Among them, 10 went to New York, e.g. 30 trips (3 on average per person).

I can select both data in the table. So far, so good.

 

What I need help is to select, among ONLY these 10 users that travelled to New York (30 trips), how many trips they also had to other places and which places were that. 

E.g.

User 1 went 10 times to NY, and also 3 times to California

User 2 went 1 time to NY, and also 30 times to China

User 3 went 5 times to NY, and also 1x to California and 1x to China

User 4 went 2 times to NY, and 20 times to Brazil...

 

Thx in advance.

1 ACCEPTED SOLUTION
v-jingzhang
Community Support
Community Support

Hi @patricia_csf

 

I used the following sample data to realize it, please refer to the steps below and let me know if it helps.

112708.jpg

 

First create a new table with the following DAX codes to filter the trips of those users who travelled to NY.

NY_User_Trips =
FILTER (
    Trips,
    Trips[User]
        IN (
            SUMMARIZE ( FILTER ( Trips, Trips[Destination] = "New York" ), Trips[User] )
        )
)

 112706.jpg

 

Then use a Matrix visual, put User as Rows, Destination as Columns, Count of Destination as Values (click the drop-down arrow to change Destination's aggregate type into Count) from the new table.

112707.jpg

 

If you don't want to show NY trips, you can apply a Destination filter on the visual with NY unselected. Otherwise, you can also modify the new table DAX codes into:

NY_User_Trips =
FILTER (
    Trips,
    Trips[User]
        IN (
            SUMMARIZE ( FILTER ( Trips, Trips[Destination] = "New York" ), Trips[User] )
        )
            && Trips[Destination] <> "New York"
)

 

 

Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

View solution in original post

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @patricia_csf

 

I used the following sample data to realize it, please refer to the steps below and let me know if it helps.

112708.jpg

 

First create a new table with the following DAX codes to filter the trips of those users who travelled to NY.

NY_User_Trips =
FILTER (
    Trips,
    Trips[User]
        IN (
            SUMMARIZE ( FILTER ( Trips, Trips[Destination] = "New York" ), Trips[User] )
        )
)

 112706.jpg

 

Then use a Matrix visual, put User as Rows, Destination as Columns, Count of Destination as Values (click the drop-down arrow to change Destination's aggregate type into Count) from the new table.

112707.jpg

 

If you don't want to show NY trips, you can apply a Destination filter on the visual with NY unselected. Otherwise, you can also modify the new table DAX codes into:

NY_User_Trips =
FILTER (
    Trips,
    Trips[User]
        IN (
            SUMMARIZE ( FILTER ( Trips, Trips[Destination] = "New York" ), Trips[User] )
        )
            && Trips[Destination] <> "New York"
)

 

 

Community Support Team _ Jing Zhang
If this post helps, please consider Accept it as the solution to help other members find it.

amitchandak
Super User
Super User

@patricia_csf , Try a measure like

new measure =
var _usr = summarize(filter(Table, Table[City] = "New York" ), Table[User])
return
calculate(count(*) , filter(Table, Table[City] <> "New York" && Table[User] in _usr ))

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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