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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
aallman
Helper I
Helper I

Toggle between columns used in a date slicer

Hello hopefully this is pretty straightforward.

I am wondering if it is possible to have a date slicer on my page, but allow the user to toggle between two dates. For example, I have order date and due date. I want to have just one date slicer on the page, but allow the user to select "Order Date" or "Due Date" from another slicer. Based on their selection, I want the date slicer to use the appropriate date field. Is that possible? I have looked into a slicer table and then a measure, but in the measure I am not sure how to return the date values to use in a slicer, only to return calculated values such as counts and totals.

1 ACCEPTED SOLUTION
OwenAuger
Super User
Super User

Hi @aallman 

I would recommend using the method described here:

https://www.sqlbi.com/articles/using-calculation-groups-to-switch-between-dates/

This article includes a video and sample files.

 

In your case, this method would involve:

  • Date table with one active relationship and one inactive relationship with your fact table (on the Order Date and Due Date columns).
  • Calculation group with two calculation items named corresponding to these two dates, that allows selection of which relationship to activate.
  • Slicer to select between the calculation items.

With this method, the 'Date'[Date] columnis always used on the Date slicer, but the column that it has an active relationship with is switched using the calculation group.

 

Does something like this work for you? Please post back with more detail if needed.

 

P.S. Field parameters are another option for switching the column used in a slicer or an other visual, but I would say that the calculation group makes better sense from a modelling point of view in this case.


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

View solution in original post

1 REPLY 1
OwenAuger
Super User
Super User

Hi @aallman 

I would recommend using the method described here:

https://www.sqlbi.com/articles/using-calculation-groups-to-switch-between-dates/

This article includes a video and sample files.

 

In your case, this method would involve:

  • Date table with one active relationship and one inactive relationship with your fact table (on the Order Date and Due Date columns).
  • Calculation group with two calculation items named corresponding to these two dates, that allows selection of which relationship to activate.
  • Slicer to select between the calculation items.

With this method, the 'Date'[Date] columnis always used on the Date slicer, but the column that it has an active relationship with is switched using the calculation group.

 

Does something like this work for you? Please post back with more detail if needed.

 

P.S. Field parameters are another option for switching the column used in a slicer or an other visual, but I would say that the calculation group makes better sense from a modelling point of view in this case.


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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