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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
LotteLaugesen
Helper V
Helper V

Find first date in table where date greater than invoice date

Hi

How do I find max Valid from in the Interest table where Invoice date >= Valid from?
Invoice date = 2021-11-16 and I want to get row 2, Valid from 2021-11-15
Interest table

LotteLaugesen_0-1645529490107.png

Any ideas?

 

Lotte

 

1 ACCEPTED SOLUTION

Try

Intrest Lookup Date =
MAXX (
    FILTER ( ALL ( Table ), Table[Valid from] <= MAX ( Invoice[Invoice Date] ) ),
    Table[Valid from]
)

View solution in original post

12 REPLIES 12
tamerj1
Super User
Super User

Hi @LotteLaugesen 
You can use

Intrest Lookup Date =
MAXX (
    FILTER ( Table, Table[Valid from] <= MAX ( Invoice[Invoice Date] ) ),
    Table[Valid from]
)

Hi tamerj1

Unfortunately I then get 2021-12-20 in return and not 201-11-15

But thanks anyway

 

Try

Intrest Lookup Date =
MAXX (
    FILTER ( ALL ( Table ), Table[Valid from] <= MAX ( Invoice[Invoice Date] ) ),
    Table[Valid from]
)

Same result - but thanks for trying 👍

Hi @LotteLaugesen 
I'm getting correct results. See the screen shot. But I think it depends on your data model and relationships. Most probably you have a connected date table. Can you please send a screen shot of your data model with the relationships?
Thanks and have a nice day! 
1.png

Here is my datamodel and contents of NFV Interest Rates:

LotteLaugesen_0-1645607969662.png
LotteLaugesen_4-1645608817516.png

And this is the calculation and result

LotteLaugesen_1-1645608309265.png

LotteLaugesen_3-1645608383219.png

Thanks for your time 🙂

 

 

@LotteLaugesen 
Are you sure invoice date is of date data type? It looks like it is of text data type 🙂

I'm wondering why it looks like that, too...

But look here:

LotteLaugesen_0-1645612867828.png

 

Check the data source from power query. Or if you don't mind can you please a sample data version of the file?

Sorry about all this - I had made the calculation as a new column in the Merge ARAP and SCF table and not as a new measure 🙈  So after changing that it works perfectly
Thanks for all you time  

amitchandak
Super User
Super User

@LotteLaugesen , You can create a new measure

 

calculate(sum(Table[Intrest]), filter(Table, Table[Valid from] >= max(Invoice[Invoice Date]) ) )

 

 

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Unfortunately it doesn't work. I get the sum of all interest 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

Feb2025 NL Carousel

Fabric Community Update - February 2025

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