Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
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
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
14 | |
10 | |
10 | |
9 | |
9 |
User | Count |
---|---|
20 | |
13 | |
12 | |
11 | |
8 |