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
greatzt
Helper II
Helper II

how to use DAX or other ways to implement prefiltered slicer(slicer choices dynamically changing)?

I know prefiltered filter can be implemented by using bi-direction relation between dimension and fact tables.  However, in a multi-facts table model, you cannot not make all the relation ship bi-direction since it will produce ambiguous filtering path. The following is an example.

datamodel.PNG

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The FactPrice table has three dimensions: Supplier, Product and Terminal. The FactCotract has two dimension: Supplier and Terminal.

The supplier and terminal are common dimensions of there two fact tables.  Now relationship between Terminal and FactPrice  are bi-direction and relation between Supplier and Factprice can't be set as bi-directoin since it will generate ambiguous filtering path. 

 

The following is a simple report based on this model. demo report.PNG

 

 

 

 

 

 

 

 

 

 

 

 

Since Terminal is bi-direction filtered to FactPrice , when user choose Proudct or Supplier slicer, the Terminal slicer will be prefiltered or change dynamically.  Because Proudct and Supplier are only single direction related to fact PriceFact table,  when user select Terminal slicer, Product and Supplier slicer will not be prefiltered.  What I want to do is to make all these filter prefiltered by using DAX or other workaround.  Does anyone has any ideas? . The pbix file can be found here

 

 

 

 

6 REPLIES 6
v-lili6-msft
Community Support
Community Support

hi, @greatzt

It couldn't achieve by using DAX or other workaround and only can be affected by using bi-direction relation.

For your data model, It has two relation route from Supplier to Terminal. you don't need to create a relationship between FactContract and Terminal.

So try to romove it and make the relationship between Supplier and Factprice to be set as bi-direction.

 

Best Regards,

Lin

 

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lili6-msft  I need to keep the contract fact table since the fact table relies on Terminal and Supplier dimension. I can't combine two fact table either because contract does not involve Product dimension.  since PowerBI does not allow visual filter on slicer, I can't use  customer measure to filter slicer.  I will Power BI can support it as the some BI  tool do.

hi, @greatzt

You may try to Append the FactContract and FactPrice in Power Query or Use Union Function when Modeling data.

Be careful about column order of two table

For example:

5.JPG6.JPG

Best Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@v-lili6-msft Thank you for input. Your soluation is  probably working for small dataset.  However,  If  FactPrice table is big (million rows) and Factcontract table has some dimensions which are not applied to Factprice table,  the  combined fact table will become very large since there will be many repetitive info. 

Stachu
Community Champion
Community Champion

compression in Tabular is really good, so having the table appended together shouldn't be a real issue - from what I see only few columns are not overlapping

otherwise you can try INTERSECT/TREATAS
https://www.sqlbi.com/articles/physical-and-virtual-relationships-in-dax/



Did I answer your question? Mark my post as a solution!
Thank you for the kudos 🙂

greatzt
Helper II
Helper II

any input for this question?

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.