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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Asmoday1507
Frequent Visitor

Calculating changing date

Hi everyone!

I'd like to calculate the date of sale (stock exit) for the following data, but when trying to use the earlier function, it doesn't quite work out for me.

I would like it to be a calculation column.

 

Asmoday1507_0-1644262952144.png

 

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

Hi @Asmoday1507 ,

 

Try this Column.

 

Expected sale date = 
IF (
    'Table'[Stock]
        <> CALCULATE (
            SUM ( 'Table'[Stock] ),
            LASTDATE ( 'Table'[Date] < EARLIER ( 'Table'[Date] ) ),
            ALL ( 'Table'[Stock] )
        ) && 'Table'[Date] <> MIN('Table'[Date]),
    'Table'[Date]
)

 

The result should be like this.

vcgaomsft_1-1644314615890.png

Also, attached the pbix file as the reference.

 

Best Regards,

Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

View solution in original post

3 REPLIES 3
v-cgao-msft
Community Support
Community Support

Hi @Asmoday1507 ,

 

Try this Column.

 

Expected sale date = 
IF (
    'Table'[Stock]
        <> CALCULATE (
            SUM ( 'Table'[Stock] ),
            LASTDATE ( 'Table'[Date] < EARLIER ( 'Table'[Date] ) ),
            ALL ( 'Table'[Stock] )
        ) && 'Table'[Date] <> MIN('Table'[Date]),
    'Table'[Date]
)

 

The result should be like this.

vcgaomsft_1-1644314615890.png

Also, attached the pbix file as the reference.

 

Best Regards,

Community Support Team_Gao

 

If there is any post helps, then please consider Accept it as the solution to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

TheoC
Super User
Super User

Hi @Asmoday1507 - you should be able to achieve what you're after using MAXX function.

If I have posted a response that resolves your question, please accept it as a solution to formally close the post.

Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!

Want to connect?www.linkedin.com/in/theoconias

sevenhills
Super User
Super User

I think your screenshot does not reflect what you need ...

 

Can you explain in few lines and also check the screenshot image adapt those requirements?

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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