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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
aking11
Regular Visitor

lookup if record exists in date range

hey all - new to powerbi and trying to build a report. I feel like it should be simple to do, but am stumped! 

 

I have two tables with an active relationship. A list of employees in one table, then a list of meeting notes in another (employee ID is the relationship). One meeting has to occur within each quarter (Jan-Mar, Apr-Jun, etc). I want to know if a meeting has taken place within each quarter... how would i go about finding this information? I would like to be able to add the new measure (or whatever is best) to a table visual to show if somethign has or has not happened this qtr, etc. 

 

Thanks for the help!

1 ACCEPTED SOLUTION
v-jialongy-msft
Community Support
Community Support

@lbendlin  @PhilipTreacy  Thanks for your prompt reply!

 

I tried to create a sample data myself based on the user's requirement and implemented the result. Please check if there is anything that can be improved. Here is my solution: 

 

Hi @aking11 

Based on your needs, I have created the following table.

vjialongymsft_0-1714114764838.png

vjialongymsft_1-1714114787072.png

 

You can use the following Dax to find out if there are meetings for the quarter.

Q1 2024 = 
IF (
    SELECTEDVALUE ( 'Table'[Employee ID] )
        = SELECTEDVALUE ( 'Table (2)'[Employee ID] ),
    IF (
        MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) <= 3
            && MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) >= 1,
        "yes",
        "no"
    )
)
Q2 2024 = 
IF (
    SELECTEDVALUE ( 'Table'[Employee ID] )
        = SELECTEDVALUE ( 'Table (2)'[Employee ID] ),
    IF (
        MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) <= 6
            && MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) >= 4,
        "yes",
        "no"
    )
)
Q3 2024 = 
IF (
    SELECTEDVALUE ( 'Table'[Employee ID] )
        = SELECTEDVALUE ( 'Table (2)'[Employee ID] ),
    IF (
        MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) <= 9
            && MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) >= 7,
        "yes",
        "no"
    )
)
Q4 2024 = 
IF (
    SELECTEDVALUE ( 'Table'[Employee ID] )
        = SELECTEDVALUE ( 'Table (2)'[Employee ID] ),
    IF (
        MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) <= 12
            && MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) >= 10,
        "yes",
        "no"
    )
)

 

vjialongymsft_4-1714115154055.png

 

 

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
v-jialongy-msft
Community Support
Community Support

@lbendlin  @PhilipTreacy  Thanks for your prompt reply!

 

I tried to create a sample data myself based on the user's requirement and implemented the result. Please check if there is anything that can be improved. Here is my solution: 

 

Hi @aking11 

Based on your needs, I have created the following table.

vjialongymsft_0-1714114764838.png

vjialongymsft_1-1714114787072.png

 

You can use the following Dax to find out if there are meetings for the quarter.

Q1 2024 = 
IF (
    SELECTEDVALUE ( 'Table'[Employee ID] )
        = SELECTEDVALUE ( 'Table (2)'[Employee ID] ),
    IF (
        MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) <= 3
            && MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) >= 1,
        "yes",
        "no"
    )
)
Q2 2024 = 
IF (
    SELECTEDVALUE ( 'Table'[Employee ID] )
        = SELECTEDVALUE ( 'Table (2)'[Employee ID] ),
    IF (
        MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) <= 6
            && MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) >= 4,
        "yes",
        "no"
    )
)
Q3 2024 = 
IF (
    SELECTEDVALUE ( 'Table'[Employee ID] )
        = SELECTEDVALUE ( 'Table (2)'[Employee ID] ),
    IF (
        MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) <= 9
            && MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) >= 7,
        "yes",
        "no"
    )
)
Q4 2024 = 
IF (
    SELECTEDVALUE ( 'Table'[Employee ID] )
        = SELECTEDVALUE ( 'Table (2)'[Employee ID] ),
    IF (
        MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) <= 12
            && MONTH ( SELECTEDVALUE ( 'Table (2)'[Meeting Date] ) ) >= 10,
        "yes",
        "no"
    )
)

 

vjialongymsft_4-1714115154055.png

 

 

 

 

 

 

Best Regards,

Jayleny

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

Use a (disconnected) calendar table that has dates and quarters. Then in your measure verify if the dates in the quarter INTERSECT with the meetings.  A zero result means no meetings were held in that quarter.

PhilipTreacy
Super User
Super User

Hi @aking11 

 

Not enough info.  What is the Employee ID for? Yuo said you want to know if a meeting has taken place each quarter.  What exactly are the criteria?  Any meeting?  Or is it related to each Employee?

 

What exactly do you want to see as a result - please supply an example.

 

Also please supply some data otherwise we have to recreate everything and guess what data you have. 

 

Regards

 

Phil



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Hey Phil - here is some more info:

There is an employee ID associated with each employee. The ID is in both tables. One table is just demographic information of the employees, names, locations, job, etc. The other table houses records of meetings with their mentor. We have an expectation that there is a mentor meeting once per quarter. The mentors log their meetings in this table that includes the employee ID and notes about the meeting (including date). There is only a record if the meeting took place. Something like the below:

 

Employee IDFirst NameLast Name
1234JoeSmith

 

Employee IDMentorMeeting DateMeeting Type
1234John4/11/2024Phone Call

 

The output I am looking for is to be able to see if there was a meeting/contact made during each quarter. So add a column to a table that includes YES/NO, etc for each Quarter. Hope that makes sense. 

 

Employee IDFirst NameLast NameQ1 2024Q2 2024
1234JoeSmithNOYES

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.