Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
PhilJuniper
Frequent Visitor

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
1 ACCEPTED SOLUTION
mickey64
Super User
Super User

Step 0: I use these data table below.

- 'Risk' Table -

mickey64_1-1721138886135.png

- 'Date' Table -

mickey64_2-1721138944355.png

 

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 -

mickey64_4-1721139301969.png

- Matrix -

mickey64_3-1721139205566.png

 

Step 3: I set up the filter.

mickey64_5-1721139410503.png

 

 

View solution in original post

2 REPLIES 2
mickey64
Super User
Super User

Step 0: I use these data table below.

- 'Risk' Table -

mickey64_1-1721138886135.png

- 'Date' Table -

mickey64_2-1721138944355.png

 

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 -

mickey64_4-1721139301969.png

- Matrix -

mickey64_3-1721139205566.png

 

Step 3: I set up the filter.

mickey64_5-1721139410503.png

 

 

amitchandak
Super User
Super User

@PhilJuniper , seem like very similar to HR Active employee problem, with Date table you should be able to do so

 

Power BI: HR Analytics - Employees as on Date : https://youtu.be/e6Y-l_JtCq4
https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-tr...
Power BI HR Active Employee Tenure Bucketing, and Hired, Terminated, and Active employees: https://youtu.be/fvgcx8QLqZU

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors