Forum Discussion
Formula using nearest time before a calculated value?
- 9 years ago
According to your description, you can use LOOKUPVALUE function to search Questions[Student ID], Questions[Question ID], Questions[Question Date] in Responses table, if the returned value is Blank and Active of student = FALSE, then the corresponding Question ID is the last question ID when the student is stopped. See my sample below.
I assume you have tables like below.
Students
Questions
Responses
1. Use the formula below to create a calculate column called "Is Stop" in Questions table to check if the Question ID is the last Question ID when the student is stopped.
Is Stop = IF ( ISBLANK ( LOOKUPVALUE ( Responses[Student ID], Responses[Student ID], Questions[Student ID], Responses[Question ID], Questions[Question ID], Responses[Question Date], Questions[Question Date] ) ) && RELATED ( Students[Active] ) = FALSE (), "Stop" )2. Then you should be able to show these Question IDs in report with a Slicer of column "Is Stop" like below.
Regards
That's giving me the same count as the previous report table with the Stop slicer clicked, most of the time. Sometimes the count is higher.
For anyone reading this: The solution above IS correct. I modelled it out with dummy data. In my real model, something is causing the Is Stop not to report/slice correctly, even when I perform the CALCULATE/FILTER as suggested above. May be something with my relationships model or some filter I've applied somewhere.