Forum Discussion
alex_yk_yeung
2 years agoNew Member
Using DAX to return a specific value when metric in another colume reached certain value
Dear all
I am trying to use DAX language to return the time of in the day which the total stock sold has reached or higher than stock_in (stock received) [i.e. the metric"%Sold_over_Recd" is 1 or above], in the below example, I wish to return "1:00:00PM" as the return value.
Would love to learn your advice on how this could be achieved with the use of the DAX language, thank you very much in advance!
If need any further clarification on the above question, please feel free to let me know, cheers.
FirstMinimumDateTimeWherePercentageIsOneOrMore = CALCULATE( MINX( FILTER( ADDCOLUMNS( 'Table', "PercentageMeasure", [Percentage] ), [PercentageMeasure] >= 0.01 ), 'Table'[DateTime] ) )
2 Replies
- aduguid
Memorable Member
FirstMinimumDateTimeWherePercentageIsOneOrMore = CALCULATE( MINX( FILTER( ADDCOLUMNS( 'Table', "PercentageMeasure", [Percentage] ), [PercentageMeasure] >= 0.01 ), 'Table'[DateTime] ) ) - alex_yk_yeungNew Member
It works! Thank you very much aduguid !
Now I am able to identify the earliest time when stock is went out, thanks again!