The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi guys,
Hope you can help me here..... I have been looking in google to find a dax formula with no luck.
What i am trying to do is create a dax column for my visual table to show the city from the lowest Date for each ID - see example below
Is this possible?
ID | Date | City | Column |
55555 | 01/01/20 10:34:36 | Leeds | Leeds |
55555 | 01/01/20 10:35:02 | Sheffield | Leeds |
66666 | 02/01/20 00:12:40 | Bristol | Bristol |
66666 | 02/01/20 00:12: 45 | Bradford | Bristol |
66666 | 02/01/20 00:12:57 | Bradford | Bristol |
Solved! Go to Solution.
Hi,
This should do the trick:
___firstCity =
var _firstDate = CALCULATE(MIN([Date]), ALLEXCEPT('Table','Table'[ID]))
return
CALCULATE(MIN('Table'[City]), FILTER(ALLEXCEPT('Table','Table'[ID]),[Date]=_firstDate))
as seen here:
As demonstrated here.
the file available here.
Please mark as a solution if so. Thumbs up for the effort are appreciated.
Kind regards,
Steve.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Hi,
This should do the trick:
___firstCity =
var _firstDate = CALCULATE(MIN([Date]), ALLEXCEPT('Table','Table'[ID]))
return
CALCULATE(MIN('Table'[City]), FILTER(ALLEXCEPT('Table','Table'[ID]),[Date]=_firstDate))
as seen here:
As demonstrated here.
the file available here.
Please mark as a solution if so. Thumbs up for the effort are appreciated.
Kind regards,
Steve.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Welcome! Keep learning, it gets more easy over time.
Proud to be a Super User!
Awesome Keyboard Shortcusts in Power BI, thumbs up if you like the article
My Community Blog Articles (check them out!)
My Blog - Power M code to automatically detect column types -
How to create test data using DAX!
Hi @f1rich ,
Try this measure:
NewColumn =
VAR _minDate = CALCULATE(MIN([Date]), ALLEXCEPT('Table', 'Table'[D]))
VAR _minCity = CALCULATE(MAX('Table'[City]), FILTER(ALLEXCEPT('Table', 'Table'[D]), [Date] = _minDate))
RETURN _minCity
Morning @camargos88
Unfortunately the fomula is not working because it is picking the last letter from City not from the date and ID - see example below
ID | Date | City | Column |
77777 | 05/01/2020 20:36:22 | Rotherham | Sheffield |
77777 | 05/01/2020 20:36:25 | Sheffield | Sheffield |
What I need is to show the first city from the earliest date from the same ID - see below
ID | Date | City | Column |
66666 | 05/01/2020 19:02:03 | Barnsley | Barnsley |
66666 | 05/01/2020 19:02:06 | Cudworth | Barnsley |
77777 | 05/01/2020 20:36:22 | Rotherham | Rotherham |
77777 | 05/01/2020 20:36:25 | Sheffield | Rotherham |
88888 | 05/01/2020 21:04:34 | Bristol | Bristol |
Thank you
User | Count |
---|---|
11 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
24 | |
14 | |
13 | |
9 | |
8 |