Forum Discussion

nanutum's avatar
nanutum
Icon for Helper I rankHelper I
6 years ago
Solved

LASTDATE ERROR MDXSCRIPT PLEASE HELP

i have 2 meaure can used normally 

but today get error below please help

 

 

Stock_Case_LastDate = SUMX (
    VALUES ( 'Sold to party' ),
    CALCULATE ( SUM ( Stock[Case]),LASTDATE( ( Stock[Stock_Date] ) )
))

 

 

get this error 

 

 

 

Stock_Case_LastDate = SUMX (
    VALUES ( 'Sold to party' ),
    CALCULATE ( SUM ( Stock[Case]),LASTDATE( ( Stock[Stock_Date] ) )
))

 

 get this error

 

  • Hello @nanutum ,

    Can you try modifying the DAX expression for the measure as follows:

    Stock_Case_LastDate = 
    var maxDate = CALCULATE(MAX(Stock[Stock_Date]))
    RETURN
    CALCULATE(SUM(Stock[Case]), ALL(Stock), Stock[Stock_Date] = maxDate)
    

    Thank you

    Pragati

8 Replies