Forum Discussion

EllenG's avatar
EllenG
Frequent Visitor
5 years ago
Solved

Max (date) measure error message

Would appreciate help understanding why the below measure isn't working - the error is "a single value for Delivery Date cannot be deterimined. This can happen ...when the column contains may values without specifying an aggreggation."
 
thank you!
 
LastOrdered = CALCULATE(max(Sales[Delivery Date],filter(Sales, Sales[Amount]>0)))
  • Hi EllenG ,

    Just as amitchandak mentioned,Wrongly place parenthesis.

    the following data,base data:

    If you want to determine if there is an Amount greater than 0 for that day and output the date if there is, then use the following measure,just what  amitchandak  provided:

    LastOrdered = CALCULATE(max(Sales[Delivery Date]),filter(Sales, Sales[Amount]>0))

     

     

    If you want to get the largest date of all dates with amount > 0, then use the following measure:

    LastOrdered = CALCULATE(max(Sales[Delivery Date]),filter(ALL(Sales), Sales[Amount]>0))

     

     

    Wish it is helpful for you!

     

    Best Regards

    Lucien

2 Replies

  • EllenG , Try like

     

    LastOrdered = CALCULATE(max(Sales[Delivery Date]),filter(Sales, Sales[Amount]>0))

     

    Wrongly place parenthesis

  • v-luwang-msft's avatar
    v-luwang-msft
    Community Support

    Hi EllenG ,

    Just as amitchandak mentioned,Wrongly place parenthesis.

    the following data,base data:

    If you want to determine if there is an Amount greater than 0 for that day and output the date if there is, then use the following measure,just what  amitchandak  provided:

    LastOrdered = CALCULATE(max(Sales[Delivery Date]),filter(Sales, Sales[Amount]>0))

     

     

    If you want to get the largest date of all dates with amount > 0, then use the following measure:

    LastOrdered = CALCULATE(max(Sales[Delivery Date]),filter(ALL(Sales), Sales[Amount]>0))

     

     

    Wish it is helpful for you!

     

    Best Regards

    Lucien