Forum Discussion
Getting previous date by category, not min date
- 4 years ago
Thanks for clearer explanation, below you can try the new measure for the different of the days compare to previous ID.
Measure =var forid = SELECTEDVALUE('Table'[ID])var selectdate = SELECTEDVALUE('Table'[Date])var previousdate = CALCULATE(MAX('Table'[Date]),FILTER(ALL('Table'),'Table'[ID]=forid-1))var result = DATEDIFF(previousdate,selectdate,DAY)returnIF(previousdate=BLANK(),BLANK(),result)
Another measure is the status:Status =var forid = SELECTEDVALUE('Table'[ID])var forcategory = SELECTEDVALUE('Table'[Category])var result = CALCULATE(MAX('Table'[Category]),FILTER(ALL('Table'),'Table'[ID]=forid-1))returnIF(result=BLANK(), BLANK(), IF(forcategory<>result, "Change", "No Change"))Hope this can help you.
- 4 years ago
Hi Anonymous
If the problem has been solved you can mark the reply for the standard answer to help the other members find it more quickly. If not, please point it out.
Looking forward to your feedback.
Best Regards,
Henry
Hi Anonymous ,
You can try formula like below:
Col = RANKX('Table','Table'[Date],,DESC,Dense)M_ =
VAR min_ =
MIN ( 'Table'[Date] )
VAR max_ =
CALCULATE ( MAX ( 'Table'[Date] ), 'Table'[Col] = 3 )
RETURN
DATEDIFF ( min_, max_, DAY )
If the problem is still not resolved, please provide detailed error information and let me know immediately. Looking forward to your reply.
Best Regards,
Henry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Anonymous4 years agoNot applicable
Hello thank you for the reply, the last post in this thread has my sample data and and an explanation of what I am trying to do. I can see where RANKX can be useful but I cuold not get the desired result, I am trying to count the number of days in each category, please see my sample data posted earlier today.