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

Level up your Power BI skills this month - build one visual each week and tell better stories with data! Get started

Reply
coollehavre
Frequent Visitor

find previous value in a snapshot table

Hi everyone,

i have a snapshot table (same employees every month in a single table) and i need to compare job_id for an employee from previous month 

 

i would like to create a calculated column or measure (job_id_previous_month) like this : 

 

employee_idjob_idsnapshot_datejob_id_previous_month
E001J12331/01/2024 
E002J23031/01/2024 
E003J23031/01/2024 
E001J23528/02/2024J123
E002J23028/02/2024J230
E003J23028/02/2024J230

 

Any help to do this ? 

 

Thanks 

3 ACCEPTED SOLUTIONS
Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1726903466838.png

 

 

job_id_previous_month CC =
VAR _currentrowemployee = data[employee_id]
VAR _currentrowmonth = data[snapshot_date]
RETURN
    MAXX (
        FILTER (
            data,
            data[employee_id] = _currentrowemployee
                && data[snapshot_date] = EOMONTH ( _currentrowmonth, -1 )
        ),
        data[job_id]
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

View solution in original post

ThxAlot
Super User
Super User

ThxAlot_0-1726910445556.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



View solution in original post

dharmendars007
Memorable Member
Memorable Member

Hello @coollehavre , 

 

Please try the below code..

 

job_id_previous_month =
VAR currentEmployee = 'Table'[employee_id]
VAR currentDate = 'Table'[snapshot_date]
RETURN
CALCULATE(MAX('Table'[job_id]),FILTER('Table','Table'[employee_id] = currentEmployee &&

EOMONTH('Table'[snapshot_date], 0) = EOMONTH(currentDate, -1)))

 

dharmendars007_0-1726915016338.png

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

View solution in original post

3 REPLIES 3
dharmendars007
Memorable Member
Memorable Member

Hello @coollehavre , 

 

Please try the below code..

 

job_id_previous_month =
VAR currentEmployee = 'Table'[employee_id]
VAR currentDate = 'Table'[snapshot_date]
RETURN
CALCULATE(MAX('Table'[job_id]),FILTER('Table','Table'[employee_id] = currentEmployee &&

EOMONTH('Table'[snapshot_date], 0) = EOMONTH(currentDate, -1)))

 

dharmendars007_0-1726915016338.png

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

ThxAlot
Super User
Super User

ThxAlot_0-1726910445556.png



Expertise = List.Accumulate(


        {Days as from Today},


        {Skills and Knowledge},


        (Current, Everyday) => Current & Day.LearnAndPractise(Everyday)


)



Jihwan_Kim
Super User
Super User

Hi,

Please check the below picture and the attached pbix file.

 

Jihwan_Kim_0-1726903466838.png

 

 

job_id_previous_month CC =
VAR _currentrowemployee = data[employee_id]
VAR _currentrowmonth = data[snapshot_date]
RETURN
    MAXX (
        FILTER (
            data,
            data[employee_id] = _currentrowemployee
                && data[snapshot_date] = EOMONTH ( _currentrowmonth, -1 )
        ),
        data[job_id]
    )

If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.