Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.
Check it out now!Microsoft is giving away 50,000 FREE Microsoft Certification exam vouchers. Get Fabric certified for FREE! Learn more
Hello,
I need to calculate how many days gap each stock has until I see the first value, but I couldn't find a solution.
It has to take into account up to the first value it encounters.
Can you help me?
Thank you for your support.
To calculate the number of days until the first value for each stock, you can use a combination of DAX functions such as FILTER, MINX, and DATEDIFF. Try this:
Days Until First Value =
VAR FirstValueDate = MINX(FILTER(StockData, [Value] <> BLANK()), [Date])
RETURN IF(ISBLANK(FirstValueDate), BLANK(), DATEDIFF(StockData[Date], FirstValueDate, DAY))
Unfortunately it doesn't work.