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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
glizzzd
New Member

Filter Both Table if value exists in one and other fact table

Hi,

 

I have two fact tables A & B. From A I am pulling data on cost, from B budgets. For both I created calculated column which is a combination of three columns. I also created another table C joining these with one to many relationship. The goal is to filter table A and B, using table C. If value exists in a table A & B i want to call this filter "Including", if not "Excluding".

 

Table A:

cost centeraccountentitycost ($)calculated_col
A1X10A1X
B2Y20B2Y
C3Z30C3Z

 

Table B:

cost centeraccountentitycost ($)calculated_col
A1X10A1X
B2Y20B2Y
C3Z30C3Z

 

Table C:

A1X
CVY
C3Z

 

My current solution is I set up filter to be calculated column from table A, set bidirectional filtering to table C and then from C to A single filtering. But the filter works only if i select and deselect and select one more time.

 

glizzzd_0-1714031187986.png

 

1 ACCEPTED SOLUTION
v-heq-msft
Community Support
Community Support

Hi @glizzzd ,
Based on your description, I created the following dax expression and applied it to this visual object

Measure = 
IF(
    SELECTEDVALUE('Table A'[calculated_col]) IN VALUES('Table C'[Filter]),
    "Including",
    "Excluding"
    )

When we set the filter condition to "Including", the visual object will keep all the data with "Including" returned by the measue condition, and these filtered data can still be used by other filters afterward. filtered data can still be used by other filters later. In the end, the visual object will only keep the data that matches all the filters.

vheqmsft_0-1714111004497.png

 

Best regards,

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

View solution in original post

2 REPLIES 2
v-heq-msft
Community Support
Community Support

Hi @glizzzd ,
Based on your description, I created the following dax expression and applied it to this visual object

Measure = 
IF(
    SELECTEDVALUE('Table A'[calculated_col]) IN VALUES('Table C'[Filter]),
    "Including",
    "Excluding"
    )

When we set the filter condition to "Including", the visual object will keep all the data with "Including" returned by the measue condition, and these filtered data can still be used by other filters afterward. filtered data can still be used by other filters later. In the end, the visual object will only keep the data that matches all the filters.

vheqmsft_0-1714111004497.png

 

Best regards,

Albert He

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

 

glizzzd
New Member

Filter on the visual:

Filter = IF(ISBLANK(RELATED('Table C'[xxxx]))=TRUE(),"Excluding","Including")
Budget_USD_cal = CALCULATE(sum('aaa'[jksx]),ACCOUNT[vvvv]<>"BC",ALLSELECTED('SSSS'[xxxxx]))
 
If i put filter lets say to cost center and i have previously set up filter to Exclude it is not showing the values in a visual. However if i deselect Excluding and select it one more time it shows the values. What could be an issue here?

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.