Forum Discussion
Anonymous
3 years agoNot applicable
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
- FreemanZ
Super User
LASTDATE returns a table, try to replace it with MAX
- AnonymousNot applicable
when i use max then happened: the max function only accepts a column reference as an argument.
- FreemanZ
Super User
can you paste your code?
- AnonymousNot 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 - v-jianboli-msft
Community Support
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.