Forum Discussion

Betsy's avatar
Betsy
Helper IV
9 years ago
Solved

Formula using nearest time before a calculated value?

Hi there!   I have question and response data from students for which I use ID numbers (or lack thereof) as information, specifically to calculate the number of times they asked for our service to ...
  • v-ljerr-msft's avatar
    9 years ago

    Betsy

     

    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