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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
RZ89
Frequent Visitor

Get Date from first negative Value of running stock

Hi everyone,

 

I have set up a running stock report to see at which time the stock is used up.

For that I am using a matrix visual and 2 DAX measures.

 

I need a custom DAX measure that gives back the date value for reaching the first negative running stock value for a material.

In This example it will be the 17.11 for Material 15M7068

Unfortunately I am not yet able to set this up..

 

Thanks for helping me! Best regards Ralph

 

Seq =
MINX (
FILTER (
SELECTCOLUMNS (
FILTER(ALLSELECTED(CA_MD04_ALL_REQUIREMENT_999_Tage),CA_MD04_ALL_REQUIREMENT_999_Tage[Material]=MAX(CA_MD04_ALL_REQUIREMENT_999_Tage[Material])),
"index", CA_MD04_ALL_REQUIREMENT_999_Tage[Req Date],
"rank", RANKX ( ALLSELECTED ( CA_MD04_ALL_REQUIREMENT_999_Tage ), CA_MD04_ALL_REQUIREMENT_999_Tage[Req Date],,ASC, DENSE )
),
[index] = MAX ( CA_MD04_ALL_REQUIREMENT_999_Tage[Req Date] )
),
[rank]
)
 
_____________________________________
 
Running_Stock = [Stock Value] - SUMX(TOPN( [Seq]
,FILTER(ALLSELECTED(CA_MD04_ALL_REQUIREMENT_999_Tage),CA_MD04_ALL_REQUIREMENT_999_Tage[Material]=MAX(CA_MD04_ALL_REQUIREMENT_999_Tage[Material]))
,CA_MD04_ALL_REQUIREMENT_999_Tage[Req Date],ASC)
,CALCULATE(SUM(CA_MD04_ALL_REQUIREMENT_999_Tage[Open Qty]))
)
 
__________________________
 
RZ89_0-1668590341602.png

 

2 REPLIES 2
johnt75
Super User
Super User

You can try

First negative date =
FIRSTNONBLANK ( 'Date'[Date], IF ( [Running Stock] < 0, 1 ) )
RZ89
Frequent Visitor

Hi,

 

thank for the hint.

I set up that Dax measure, but I cannot drop it into my row of the matrix visual..

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

Power BI Carousel June 2024

Power BI Monthly Update - June 2024

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

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.