Forum Discussion
Filter based on date slicer
- 5 years ago
Hi benjellounm ,
First create a calendar table as below:
Calendar = CALENDAR(MIN('Table'[Award Date]),MAX('Table'[Award Date]))Then create a measure as below:
Measure = VAR _maxdate = CALCULATE ( MAX ( 'Table'[Award Date] ), FILTER ( ALL ( 'Table' ), 'Table'[Award Date] >= MINX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] ) && 'Table'[Award Date] <= MAXX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] ) && 'Table'[Company name] = MAX ( 'Table'[Company name] ) ) ) RETURN IF ( MAX ( 'Table'[Award Date] ) > MAXX ( ALLSELECTED ( 'Calendar' ), 'Calendar'[Date] ), BLANK (), IF ( MAX ( 'Table'[Award Date] ) = _maxdate, "Yes", "No" ) )And you will see:
For the related .pbix file,pls see attached.
Best Regards,
KellyDid I answer your question? Mark my post as a solution!
benjellounm add a measure using following expression and it will take care of it:
isLatest =
VAR __awardDate = MAX ( Award[Award Date] )
VAR __maxDate =
CALCULATE (
MAX ( Award[Award Date] ),
TOPN ( 1, ALLSELECTED ( Award ), CALCULATE ( MAX ( Award[Award Date] ), VALUES ( Award[Company name] ) ) , DESC )
)
RETURN
IF ( __awardDate = __maxDate, "Yes", "No" )
✨ Follow us on LinkedIn
Check my latest blog post The Power of Using Calculation Groups with Inactive Relationships (Part 1) (perytus.com) I would ❤ Kudos if my solution helped. 👉 If you can spend time posting the question, you can also make efforts to give Kudos to whoever helped to solve your problem. It is a token of appreciation!
⚡ Visit us at https://perytus.com, your one-stop-shop for Power BI-related projects/training/consultancy.⚡
Hello - Thank you for the help but it didn't work, I got all "Yes" for all the dates
| Company name | Award Date | isLatest |
| xyz | 9/1/2020 | Yes |
| xyz | 10/2/2020 | Yes |
| xyz | 11/4/2020 | Yes |
| xyz | 1/2/2021 | Yes |