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
umutkaya79
Helper I
Helper I

Getting a value from a second table by filtering from the first table

Hi,

 

I have 2 tables : 1)'Exposure - All' and 2)'tbExtractFMTenant'.

1)'Exposure - All'  has columns : 'exposure_analysis_group' and  'tenant_name'. Every 'exposure_analysis_group' has a specific tenant_name.

2)'tbExtractFMTenant' columns : tenant_name and 'trend_query_margin'. every ''tenant_name'' has their specific 'trend_query_margin'. I have a slicer from the 'exposure_analysis_group' column. I want to get the 'trend_query_margin' based on the 'exposure_analysis_group' selection. 

 

Example: 

'Exposure - All' table :    'exposure_analysis_group'         'tenant_name'

                                                        1                                          x

                                                        2                                          y

                                                        3                                          z

 

tbExtractFMTenant' table :  trend_query_margin             'tenant_name'

                                                       5.50                                     x

                                                       6.50                                     y

                                                       7.50                                     z

 

Trying to get the trend_query_margin  based on the 'exposure_analysis_group'  slicer selection.

There are no active relationships between these 2 tables and we don't want active relationship.

 

Wrote a dax but doesn't give me the trend_query_margin based on the 'exposure_analysis_group' slicer :

 

Margin =
VAR SelectedGroup = SELECTEDVALUE('Exposure - All'[exposure_analysis_group])
RETURN
CALCULATE(
MAX('tbExtractFMTenant'[trend_query_margin]),
FILTER('tbExtractFMTenant', 'tbExtractFMTenant'[tenant_name] = SelectedGroup)
)
 
If someone have any advise please. Thank you 

 

1 REPLY 1
amitchandak
Super User
Super User

@umutkaya79 , Try like

 

Margin =
VAR SelectedGroup = values('Exposure - All'[exposure_analysis_group])
RETURN
CALCULATE(
MAX('tbExtractFMTenant'[trend_query_margin]),
FILTER('tbExtractFMTenant', 'tbExtractFMTenant'[tenant_name] in  SelectedGroup)
)

 

of exploring treatas

https://docs.microsoft.com/en-us/dax/treatas-function

https://www.sqlbi.com/articles/propagate-filters-using-treatas-in-dax/

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.