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
CBirke
Regular Visitor

Changing Active Relationship for entire model and measures via Slicer

I am looking to change all measures by changing the active date relationship in the model.  I understand the USERELATIONSHIP() function within an individual measure, but I have 30-40 measures that I would rather not have to duplicate for the two differnt date type I am using.  

 

Bsically "Order Date" and "Ship Date" and I would like a button on the visuals that would allow all the charts and graphs to change to Order Date or to Ship Date as selected.  

 

I do have one date table with an active relationship to Ship Date and an inactive relationship to Order Date.   

 

Is there a way to programatically switch the model from Active to Inactive for the two relationships.   

 

I am trying to avoid using CALCULATION GROUPS due to complexity.  

 

Thank you.

3 REPLIES 3
v-cgao-msft
Community Support
Community Support

Hi @CBirke ,

 

Try creating two calendar tables and creating a field parameter using the [Date] column in both date tables.

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Thank you very much Gao.  I reviewed your demo (much appreciated).  I think I see what you are trying to do.  I am using a fiscal calendar and my filters are based on lots of different concepts like fiscal year, fiscal month, fiscal week and day as well as using filters for SAMEPERIODLASTYEAR for YoY calculations.  

 

If I understand this right, I would need to include all of the differnet options into the parameter table and function?   

 

The way I am manually handling this is to simply deactivate and activate the date relationships.  Is there code that could do that with the click of a button instead?

Hi @CBirke ,

There is no such button, in the model you have to set it up manually. In dax you can use USERELATIONSHIP() to activate and use the specified relationship.

 

Please vote for similar ideas:

Microsoft Idea

 

Best Regards,
Gao

Community Support Team

 

If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

How to get your questions answered quickly --  How to provide sample data in the Power BI Forum

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

April Fabric Community Update

Fabric Community Update - April 2024

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