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
mattwoldt
Frequent Visitor

Based Upon Selection, pull in one column of data that relates, but one column that doesn't

Hello,

 

So I work in real estate and I am in a pretty tricky scenario. We have brokers that will do deals, but within those deals other brokers will help, what I am trying to accomplish is when you select a broker, it will show their deals and then also show the brokers that helped on said deal, but I need to do it in a dynamic way, because we have thousands of brokers. 

 

For instance, John Doe did a deal labeled as 1000, in that deal there were 4 other brokers. But when I select John Doe, it will only show John Doe on that deal 1000. 

 

The other tricky part is a broker doesn't just do 1 deal, they will do a multitude of deals. I just cannot for the life of me figure out how to do this part and it is really the only piece missing in my dashboard. 

 

Thank you!

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@mattwoldt,

 

This solution uses a disconnected table Brokers, which is a distinct list of brokers in the Deals table. This table should not have a relationship with the Deals table. Here's the calculated table:

 

Brokers = DISTINCT ( Deals[Broker] )

 

Next, create the following measure:

 

Visual Filter = 
VAR vRowCount =
    CALCULATE (
        COUNTROWS ( Deals ),
        ALL ( Deals ),
        VALUES ( Deals[Deal ID] ),
        TREATAS ( VALUES ( Brokers[Broker] ), Deals[Broker] )
    )
VAR vResult =
    IF ( vRowCount > 0, 1 )
RETURN
    vResult

 

The TREATAS function treats the slicer as if it were filtering the Deals[Broker] column (the filter is applied via DAX since there is no relationship). The slicer should use Brokers[Broker].

 

Create a table visual using fields from the Deals table, and add a visual filter using the measure above:

 

DataInsights_0-1653166262611.png

 

Result:

 

DataInsights_1-1653166301996.png

 

If you already have a Brokers table in your data model and are using a Broker slicer that controls various visuals, the technique in the article below can be used.

 

https://www.sqlbi.com/articles/show-previous-6-months-of-data-from-single-slicer-selection/ 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

1 REPLY 1
DataInsights
Super User
Super User

@mattwoldt,

 

This solution uses a disconnected table Brokers, which is a distinct list of brokers in the Deals table. This table should not have a relationship with the Deals table. Here's the calculated table:

 

Brokers = DISTINCT ( Deals[Broker] )

 

Next, create the following measure:

 

Visual Filter = 
VAR vRowCount =
    CALCULATE (
        COUNTROWS ( Deals ),
        ALL ( Deals ),
        VALUES ( Deals[Deal ID] ),
        TREATAS ( VALUES ( Brokers[Broker] ), Deals[Broker] )
    )
VAR vResult =
    IF ( vRowCount > 0, 1 )
RETURN
    vResult

 

The TREATAS function treats the slicer as if it were filtering the Deals[Broker] column (the filter is applied via DAX since there is no relationship). The slicer should use Brokers[Broker].

 

Create a table visual using fields from the Deals table, and add a visual filter using the measure above:

 

DataInsights_0-1653166262611.png

 

Result:

 

DataInsights_1-1653166301996.png

 

If you already have a Brokers table in your data model and are using a Broker slicer that controls various visuals, the technique in the article below can be used.

 

https://www.sqlbi.com/articles/show-previous-6-months-of-data-from-single-slicer-selection/ 

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.