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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
YABOUSALEH
Frequent Visitor

Prior Date with Data

Hello,

 

I need to find the prior date with data as a measure,

 

Two tables, 1 is a Calander table and 1 is a Lines table,

Column Date comes from Calander, column Volume (Measure) comes from Lines

 

It has to be measure only, I am connected to a data-set and cannot create a calculated column,

 

This doesn't work:
CALCULATE(CALCULATE(MAX(Lines[Date]), DATEADD(Dates[Date],-1,DAY)), FILTER(Lines, [Volume]>0))

 

The result needed:

YABOUSALEH_0-1653929709897.png

 

Any guidance is appreciated,

Cheers,

1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @YABOUSALEH 

please try

 

 

Prior Date with Volume =
MAXX (
    FILTER (
        ALLSELECTED ( Lines ),
        [Volume] > 0
            && 'Date'[Date] < MAX ( 'Date'[Date] )
    ),
    'Date'[Date]
)

 

 

View solution in original post

5 REPLIES 5
tamerj1
Super User
Super User

Hi @YABOUSALEH 

please try

 

 

Prior Date with Volume =
MAXX (
    FILTER (
        ALLSELECTED ( Lines ),
        [Volume] > 0
            && 'Date'[Date] < MAX ( 'Date'[Date] )
    ),
    'Date'[Date]
)

 

 

This is great, almost perfect, thank you, slightly modified, used the calander table instead,

 

Original:

YABOUSALEH_2-1653942224104.png

 

 

Modified:

 

MAXX (
    FILTER (
        ALLSELECTED(Dates),
        [Volume] > 0
            && Dates[Date] < MAX ( Dates[Date] )
    ),
    Dates[Date]
)

 

 

YABOUSALEH_3-1653942287286.png

 

This might be nitpicking, any chance dates outside the filters would populate?

Great if possible, can do without,

 

PS. I confirmed your response as an answer, would you just modify the code to Dates (or Calander) instead of Lines, for consistency to the next person 🙂

 

Cheers

Anonymous
Not applicable

Please send me o copy of your measure

Anonymous
Not applicable

Hi,

 

Try this :

var actualdate=SELECTEDVALUE('Date'[Date])
return
calculate(max('Date'[Date]),'Date'[Date]<actualdate,Lines[Volume]>0)

 

 

I get an error:

YABOUSALEH_0-1653932982408.png

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 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.