Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Dax formulas

i want to find count of each product not received orders after last received order date. i tried some dax formulas, but it doesn't work.
 
Not received orders after last received order =
VAR order_date = VALUES(Sheet1[Order date])
VAR lasorderdate = CALCULATE(LASTDATE(order_date),Sheet1[Received order]>0)
VAR after_lastorder = CALCULATE(COUNTROWS(Sheet1),Sheet1[Order date]<lasorderdate)
return after_lastorder

5 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      when i use max then happened: the max function only accepts a column reference as an argument.

  • Anonymous's avatar
    Anonymous
    Not applicable

    answer:

    Measure =
    VAR lasorderdate = CALCULATE(MAXX(Sheet1,Sheet1[Order date]),Sheet1[Received order]>0)
    VAR after_lastorder = CALCULATE(COUNTROWS(Sheet1),Sheet1[Order date]<lasorderdate,Sheet1[Received order]=0)
    return after_lastorder
  • Hi Anonymous ,

     

    Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.

     

    Refer to:

    How to provide sample data in the Power BI Forum

    How to Get Your Question Answered Quickly

     

    Best Regards,

    Jianbo Li

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.