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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

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
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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