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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

I want to create 2 virtual tables using Date Filters and compare the changes in 2 tables

Hi All,

I have data with 6 columns like Date, Name, Email ID, Job Title, Department and Location.

 

image 1.JPG

I want to have 2 Date filters which will extract tables based on the two date filters.

Example show in Images below

Image 2.JPG

So I need to compare these two tables and want output in a list like

People who joined the company:

1) Sarath Kumar

 

People who left the company:

1) Anand Rajput

 

People whose Job title changed:

1) Bijoy Jha

2) Dinesh Singh

3) Raj Bose

 

 

Is this possible to handle such a situation in DAX?

Please help

 

 

 

Thanks,

Vrushab 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Please follow these steps:

1. Add a Month table(for example):

Month =
DISTINCT (
    SELECTCOLUMNS (
        CALENDAR ( "2020/1/1", "2020/12/1" ),
        "MonthNumber", MONTH ( [Date] ),
        "Month", FORMAT ( [Date], "MMMM" )
    )
)

2.3.4.1.PNG

2. Add a Name table:

Name =
DISTINCT ( 'Table'[Name] )

2.3.4.2.PNG

3. Create measures based on selected two months:

first =
CALCULATE (
    MAX ( 'Table'[Job Title] ),
    FILTER (
        'Table',
        MONTH ( [Date] ) = MIN ( 'Month'[MonthNumber] )
            && 'Table'[Name] = MAX ( 'Name'[Name] )
    )
)
second =
CALCULATE (
    MAX ( 'Table'[Job Title] ),
    FILTER (
        'Table',
        MONTH ( [Date] ) = MAX ( 'Month'[MonthNumber] )
            && 'Table'[Name] = MAX ( 'Name'[Name] )
    )
)

4. Compare [first] and [second]

Measure =
IF (
    [first] = BLANK ()
        && [second] <> BLANK (),
    " Joined",
    IF (
        [first] <> BLANK ()
            && [second] = BLANK (),
        "Left",
        IF (
            [first] <> BLANK ()
                && [second] <> BLANK ()
                && [first] <> [second],
            "Job title changed"
        )
    )
)

 

The final output is shown below:
2.3.4.3.gif

 

Please take a look at the pbix file here.

 

Best Regards,
Eyelyn Qin
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

5 REPLIES 5
Anonymous
Not applicable

Hi @Anonymous ,

 

Please follow these steps:

1. Add a Month table(for example):

Month =
DISTINCT (
    SELECTCOLUMNS (
        CALENDAR ( "2020/1/1", "2020/12/1" ),
        "MonthNumber", MONTH ( [Date] ),
        "Month", FORMAT ( [Date], "MMMM" )
    )
)

2.3.4.1.PNG

2. Add a Name table:

Name =
DISTINCT ( 'Table'[Name] )

2.3.4.2.PNG

3. Create measures based on selected two months:

first =
CALCULATE (
    MAX ( 'Table'[Job Title] ),
    FILTER (
        'Table',
        MONTH ( [Date] ) = MIN ( 'Month'[MonthNumber] )
            && 'Table'[Name] = MAX ( 'Name'[Name] )
    )
)
second =
CALCULATE (
    MAX ( 'Table'[Job Title] ),
    FILTER (
        'Table',
        MONTH ( [Date] ) = MAX ( 'Month'[MonthNumber] )
            && 'Table'[Name] = MAX ( 'Name'[Name] )
    )
)

4. Compare [first] and [second]

Measure =
IF (
    [first] = BLANK ()
        && [second] <> BLANK (),
    " Joined",
    IF (
        [first] <> BLANK ()
            && [second] = BLANK (),
        "Left",
        IF (
            [first] <> BLANK ()
                && [second] <> BLANK ()
                && [first] <> [second],
            "Job title changed"
        )
    )
)

 

The final output is shown below:
2.3.4.3.gif

 

Please take a look at the pbix file here.

 

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

Anonymous
Not applicable

@AnonymousThis works perfectly. 
Thank you so much!

Anonymous
Not applicable

Hi @Anonymous 

 

Glad you found it helpful.😀

 

Best Regards,
Eyelyn Qin

Anonymous
Not applicable

Hi Amit @amitchandak , Thanks for the response. I have only one Date column. I have duplicated the same date filter and one date filter interacts with 1 table only (interaction with other table is off). 

 

My task is to compare the two produced table and find out who left the company, who joined the company and who changed their job title.

 

I hope you understood my requirement.

 

 

Thanks,

Vrushab Jain

amitchandak
Super User
Super User

@Anonymous , how do we know the join date, termination date, or change department date? If you have two/ three dates, refer to his solution

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

 

Now the same date with two different filters on two tables. Use interactions. First filter should only interact with first table and second should interact with 2 tables

https://docs.microsoft.com/en-us/power-bi/create-reports/service-reports-visual-interactions

 

or have two date tables

example -https://community.powerbi.com/t5/Community-Blog/Comparing-Data-Across-Date-Ranges/ba-p/823601

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
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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