Forum Discussion
Anonymous
4 years agoNot applicable
Getting previous date by category, not min date
Hello all, this Measure is working as long as there are only 2 dates Min and Max, but I need to get the date before Max regardless if it's Min or not. 1 table, 1 date column and 1 category column. I ...
- 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
Anonymous
4 years agoNot applicable
Hello, thanks for the response. in my data Min(ID) will return the first record in the group, this is not the record I want, I am looking for previous date, as I add new records I am checking for change from the most recent.
Thanks
Chew_WenJie
Resolver III
4 years agoMaybe, you can show me what is the result you wanted from this table, i believe that i will have a better understanding on your requirement.