cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Datafruit
Helper I
Helper I

Date slicer - option to choose which date should filter data

Hi

 

I have such a business problem. I would need a way to filter one dataset based on three different date fields within the same dataset. So lets say I have "order date", "shipping date" and "delivery date". No the user would want to see the data, but wants to have options, whether the date slicers filters the data based on order, shipping or delivery date. 

The options could be as a check box or something similar and once the user makes a selection then the data is filtered based on that date. 

The problem I have been having is, that I have not figured out a way how to "turn on" those inactive relationships, as the active relationship with the date table is on "order date", once the user has made a selection.

 

Does anybody have ideas how to solve this?

1 ACCEPTED SOLUTION
Greg_Deckler
Super User
Super User

@Datafruit Use a disconnected table for your slicer values, order date, shipping date, etc. You can use CALCULATE and USERELATIONSHIP within a measure definition to choose the relationship based on the chosen slicer value.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

View solution in original post

6 REPLIES 6
Syndicate_Admin
Administrator
Administrator

1. Create a disconnected table (without relationships) that serves as a filter to define what type of date you are going to consult

2. Create a general date table where the user selects the date range to consult.

3. Create a measure that validates the type of date filter, the selected date range and then perform a Calculate with the SUM/COUNT... operation, the date filter and the required UserRelationShip relationship

Hi

Thanks for the response. Good ideas truly, but I am having troubles writing together the measure(s) to all of this. Can I hope for some luck, that the original poster perhaps posted a DAX code?

Datafruit
Helper I
Helper I

@Greg_Deckler And would all the relationships be inactive for the table? Plus for CALCULATE, what should be the first part, COUNTROWS perhaps? Would that work?

I really appreciate your response. Thank you!

@Datafruit Normally one of the relationships would be active. USERELATIONSHIP overrides the active relationship with the one that you specify. I don't know enough to tell you the first part of the CALCULATE. If you just want to count the number of rows (orders?) then sure, COUNTROWS will work just fine. Or you could use SUM to sum up some column, etc.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

That is the thing, I necessarily do not want to count or sum, but I want to filter the whole table based on the date the user chose and the timeframe the user wants to look at.
How would one achieve this.

Greg_Deckler
Super User
Super User

@Datafruit Use a disconnected table for your slicer values, order date, shipping date, etc. You can use CALCULATE and USERELATIONSHIP within a measure definition to choose the relationship based on the chosen slicer value.


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
collabdays lisbon

CollabDays Lisbon - 26 November 2022

Sessions include practical, hands-on experience that will help you take the next step in your career and know-how.

Difinity Conference

Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

European Share Point Conference

European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

Microsoft 365 Conference â__ December 6-8, 2022

Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.