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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
Anonymous
Not applicable

Prior Date

I have a table with jobs records by customer and work date...I have the max work date...how do I get the prior work date?

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

Hi @Anonymous ,

 

Does the measure meet your requirement?

Prior Date = 
VAR maxd =
    MAXX ( ALL ( 'Table' ), 'Table'[work day] )
RETURN
    CALCULATE (
        MAX ( 'Table'[work day] ),
        FILTER ( 'Table', 'Table'[work day] <> maxd )
    )

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.

View solution in original post

4 REPLIES 4
v-frfei-msft
Community Support
Community Support

Hi @Anonymous ,

 

Does the measure meet your requirement?

Prior Date = 
VAR maxd =
    MAXX ( ALL ( 'Table' ), 'Table'[work day] )
RETURN
    CALCULATE (
        MAX ( 'Table'[work day] ),
        FILTER ( 'Table', 'Table'[work day] <> maxd )
    )

Capture.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

This is great...thx!!!  One more follow-up question...how do I get the sales from that prior date now that I have it?

Hi @Anonymous ,

 

Then we should update the measure as below.

 

Prior Date = 
VAR maxd =
    MAXX ( ALL ( 'Table' ), 'Table'[work day] )
RETURN
    CALCULATE (
        MAX ( 'Table'[work day] ),
        FILTER ( ALL('Table'), 'Table'[work day] <> maxd )
    )

To get the sales amount based on Prior date.

sales amount pri = CALCULATE(SUM('Table'[sales]),FILTER('Table','Table'[work day] = [Prior Date]))

2.PNG

 

Community Support Team _ Frank
If this post helps, then please consider Accept it as the solution to help the others find it more quickly.
Anonymous
Not applicable

So I am still having issues...when I put your Prior Date formula into a table it is not showing the prior date properly for each line.  In the screen shot below you can see the formula, but when it translates into the table is for the most part shows the most current date plus two blanks.  The columns that show the Current Work date and Prior Work dates are correct...my biggest issue is the prior sales (hours)...any formula I write including the one you gave me returns blanks as shown in the Prior Earned Hours +(-) and

Prior Earned Hours +(-) v2 versions.  Strange that when I use the max date in the Current Earned Hours +(-) it properly shows the total hours.

Project Image_V2.png

 

 

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.

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.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.