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 info...
  • mickey64's avatar
    2 years ago

    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.