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
Tie-Tie
Frequent Visitor

Get date of latest value drop

Hi,

 

I have a two tables with following columns:

 

  1.  StockPrices (containts a dataset with stock prices update every day)
    1. Date
    2. StockID
    3. Stock Value (e.g. € 53,89)
    4. Trend (compares how much the stock prices differs from previous day; e.g. -1,2%)
  2. Stock
    1. StockID
    2. Company name

I'm interested to visualise the latest date of when a stock started to drop compared to day before.

 

Example (let's say that Microsoft has StockID = 1) StockPrices table:

1     19/05/2018 00:00:00    100         0.03
2     20/05/2018 00:00:00    99.95     -0.05
3     21/05/2018 00:00:00    99.93     -0.02
4     22/05/2018 00:00:00    99.92     -0.01
5     23/05/2018 00:00:00    112,90     0.23

I would need "20/05/2018 00:00:00" as an answer

 

I thought of a measure to calculate the maximum date of StockPrices with a filter on StockName and where previous (EARLIER) trend was positive and current trend negative; however EARLIER function is not possible for Measures.

 

Any other way to solve this?

 

Thank you.

 

Best,

1 ACCEPTED SOLUTION
CoreyP
Solution Sage
Solution Sage

Would something like this work?

 

m.Firstdate = FIRSTDATE( 'StockPrices'[Date] )



FirstDate w Neg Trend = 

CALCULATE ( [m.Firstdate] , 'StockPrices'[Trend] < 0 )

View solution in original post

2 REPLIES 2
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Tie-Tie,

 

Have you solved your problem by the solution provided by @CoreyP?

 

If you have solved, only thing that you'll have to notice, just always accept the replies making sense as solution to your question so that people who may have the same question can get the solution directly.

 

If you still need help, please feel free to ask.

 

Best Regards,

Cherry

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
CoreyP
Solution Sage
Solution Sage

Would something like this work?

 

m.Firstdate = FIRSTDATE( 'StockPrices'[Date] )



FirstDate w Neg Trend = 

CALCULATE ( [m.Firstdate] , 'StockPrices'[Trend] < 0 )

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.