Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! It's time to submit your entry. Live now!
Hi all,
I need some help.
I have a table that contains the following fields:
UserID
SiteID
Start Time (UK Date and Time eg. 31/12/2019 09:00)
Finish Time (UK Date and Time eg. 31/12/2019 17:00)
I want to group by the following:
same userID
SiteID
Start Time (Date only)
and identify the earliest date and the latest dates.
Can you help?
Solved! Go to Solution.
You can use GroupBy in power query:
or you can use dax:
Table =
ADDCOLUMNS(
GROUPBY('Start', 'Start'[UserID], 'Start'[SiteID]),
"Min Start", CALCULATE( FIRSTDATE( 'Start'[Start ])),
"Max End", CALCULATE( LASTDATE( 'Start'[Finish])))You can use GroupBy in power query:
or you can use dax:
Table =
ADDCOLUMNS(
GROUPBY('Start', 'Start'[UserID], 'Start'[SiteID]),
"Min Start", CALCULATE( FIRSTDATE( 'Start'[Start ])),
"Max End", CALCULATE( LASTDATE( 'Start'[Finish])))Thanks for reply Nick,
I'm brand new to PowerBI, so how do I get to Power Query?
Also, which of DAX or Power Query is the better choice?
Sorry @Anonymous I'm a buffoon and missed the Edit Query bit!
@Anonymous
Lol, no worries 🙂
to use the dax, go to modeling--> New Table
Since these are tables, they only get updated when you refresh the data. Unlike measures, which are updated when they are used ( like in a table). So the choice is yours between dax and power query ( though, that is a really simplified way of thinking about it, but dont want to get into the deeper topics too fast)
The Power BI Data Visualization World Championships is back! It's time to submit your entry.
| User | Count |
|---|---|
| 50 | |
| 42 | |
| 36 | |
| 31 | |
| 29 |
| User | Count |
|---|---|
| 129 | |
| 129 | |
| 59 | |
| 48 | |
| 47 |