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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

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
Anonymous
Not applicable

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?

Anonymous
Not applicable

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
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.