Forum Discussion
Apply visual level interactions without a relationship
- 7 years ago
Good morning JonPBNES
As is typical, turns out we were over thinking it. We didn't need USERELATIONSHIP, we can just read the date range selected, feed that to our filter measure and go. We do still need to compare Start Date and End Date to the date range.
OpenCaseFilter = VAR CompareStartDate = FIRSTDATE ( OpenCasesTable[Date] ) VAR CompareEndDate = LASTDATE ( OpenCasesTable[Date] ) RETURN IF ( CALCULATE ( COUNTROWS ( 'openfiltertest' ), FILTER ( openfiltertest, 'openfiltertest'[Start Date] <= CompareEndDate && 'openfiltertest'[End Date] >= CompareStartDate ) ) >= 1, "In", "Out" )You can see the result we want even after I deleted the link between the two tables.
Hi JonPBNES ,
If I understand your need correctly, you don't need to have a list based on the active start and end date, correct, taking into account that you have no relationship between the two tables.
I know I suggested to use the USERELATIONSHIP but looking at your code and reading once again your initial post believes that the best way is to make a measure as jdbuchanan71 suggested and use it on the filter visuals that way when you use your slicer the other visual will be also updated.
Can you share sample data?
Regards,
MFelix
I had a go at that measure and got a part of the way there. It is returning cases that both started and finished within the period, as opposed to those that are open in the quarter (ie has a start date before period) and I can't quite work out why.
Intuitively I feel it needs to use both relationships somehow, but then I start getting lost.
I have simplified a test data model, recreated working to date. This is here
Thanks again both for your time!
- jdbuchanan717 years agoSuper User
Good morning JonPBNES
I want to confirm that an open count for a month is one where the Start Date is <= the end of the month and the End Date >= the first of the month. The three Client ID's below would all be considered open in Jan-2018 yes?
If so, your compare is looking only at the last day of the quarter even when looking at the End Date so it is ignoring anything that ended in the quarter. Client ID 1013446 for example ended 3/20/2018 but your count is not picking it up in Q1-2018
If you change your measure slightly I think you will get the result you are looking for.
Cases Open = CALCULATE ( COUNT ( openfiltertest[Client ID] ), FILTER ( openfiltertest, openfiltertest[Start Date] <= LASTDATE ( OpenCasesTable[Date] ) && openfiltertest[End Date] >= FIRSTDATE ( OpenCasesTable[Date] ) ) )The chart below has your original measure and the updated measure side by side to illustrate the difference.
- JonPBNES7 years agoHelper I
Of course, I re-keyed my count measure wrong didn't I. What an eejit!
The issue still seems to be persisting into the drillthrough measure, however.
- jdbuchanan717 years agoSuper User
Good morning JonPBNES
As is typical, turns out we were over thinking it. We didn't need USERELATIONSHIP, we can just read the date range selected, feed that to our filter measure and go. We do still need to compare Start Date and End Date to the date range.
OpenCaseFilter = VAR CompareStartDate = FIRSTDATE ( OpenCasesTable[Date] ) VAR CompareEndDate = LASTDATE ( OpenCasesTable[Date] ) RETURN IF ( CALCULATE ( COUNTROWS ( 'openfiltertest' ), FILTER ( openfiltertest, 'openfiltertest'[Start Date] <= CompareEndDate && 'openfiltertest'[End Date] >= CompareStartDate ) ) >= 1, "In", "Out" )You can see the result we want even after I deleted the link between the two tables.