Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started
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?
Solved! Go to Solution.
@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.
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?
@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.
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.
@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.
Check out the September 2024 Power BI update to learn about new features.
Learn from experts, get hands-on experience, and win awesome prizes.
User | Count |
---|---|
113 | |
109 | |
100 | |
39 | |
31 |