Forum Discussion
Arjan_w
3 years agoFrequent Visitor
Getting "First" from column without sorting
I have a big dataset which contains of a couple of columns, but the interesting ones are: - Datetime (YYYY-MM-DD HH:MM:SS) (every row is approximately 10 seconds apart) - WeekdayName (Monday/Tues...
- 3 years ago
Try
First Weekday = SELECTCOLUMNS ( INDEX ( 1, 'Table', ORDERBY ( 'Table'[Datetime], ASC ) ), "@value", 'Table'[Weekday Name] )
Arjan_w
3 years agoFrequent Visitor
This seems to work good for the start day, thanks!
However, when looking at the last weekday (order by descending) the code takes the last day of the slicer +1. Below an example.
The latest datetime is of the correct date, however the measure doesn't follow this for some reason? 9-6-2023 is a Friday and not a Saturday.
The code that I used for the last day:
Last_Weekday =
SELECTCOLUMNS (
INDEX ( 1, 'Table', ORDERBY ( 'Table'[datetime], DESC ) ),
"@value", 'Table'[weekdayName]
)