Forum Discussion

PhilJuniper's avatar
PhilJuniper
Frequent Visitor
2 years ago
Solved

Choose a date and return relevant values

I have a risks table, as below.

I have a powerbi report that has a drop down that selects year month, eg 2024-07. Currently this is a text field.

In the report is a table that returns the risk information.

I would like to return risks where the start date is equal to or before the end of the selected month, and the finish date is equal to or after the start of the selected month. 

Is this possible?

 

Risk #Risk DescriptionStart DateEnd date
1David, watch your mouth. You come here and kiss your mother before you go, come here.01/01/202431/12/2024
2Doc, look, all we need is a little plutonium.31/01/202430/01/2025
3Good, I'll see you tonight. Don't forget, now, 1:15 a.m., Twin Pines Mall.01/03/202401/03/2025
4Good. Have a good trip Einstein, watch your head.31/03/202431/03/2025
5How could I have been so careless. One point twenty-one gigawatts. Tom, how am I gonna generate that kind of power, it can't be done, it can't.30/04/202430/04/2025
6I have to tell you about the future.30/05/202430/05/2025
7Let's get you into a radiation suit, we must prepare to reload.29/06/202429/06/2025
8Lorraine, are you up there?29/07/202429/07/2025
9Mom, is that you?28/08/202428/08/2025
  • Step 0: I use these data table below.

    - 'Risk' Table -

    - 'Date' Table -

     

    Step 1: I make 4 measures below.

        M_Date_Sel = SELECTEDVALUE('Date'[yyyy-mm])

        M_Start Date_Sel = LOOKUPVALUE('Date'[Start of the month],'Date'[yyyy-mm],[M_Date_Sel])

        M_End Date_Sel = LOOKUPVALUE('Date'[End of the month],'Date'[yyyy-mm],[M_Date_Sel])

        M_Flag = IF(MAX('Risk'[Start Date])<=[M_End Date_Sel]

                      &&MAX('Risk'[End date])>=[M_Start Date_Sel],"Yes","No")

     

    Step 2: I make a slicer and a matrix.

    - Slicer -

    - Matrix -

     

    Step 3: I set up the filter.

     

     

2 Replies