Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Anonymous
Not applicable

Create a summarised table to identify the earliest time of a date, filtered by multiple criteria

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?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

You can use GroupBy in power query:

Simple Groupby.png

 

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])))

Groupby in dax.png

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

You can use GroupBy in power query:

Simple Groupby.png

 

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])))

Groupby in dax.png

Anonymous
Not applicable

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?

Anonymous
Not applicable

Sorry @Anonymous I'm a buffoon and missed the Edit Query bit!

Anonymous
Not applicable

@Anonymous 

Lol, no worries 🙂 

 

to use the dax, go to modeling--> New Table

New Table.png

 

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)

 

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors
Top Kudoed Authors