cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
slanka Regular Visitor
Regular Visitor

Filter Group By in Same table

Friends,

 

I have data in one single table, Table A, in the below format,

 

EmpNameProjNameTimesheetDate
Emp1Proj11-Jul-19
Emp1Proj12-Jul-19
Emp1Proj13-Jul-19
Emp1Proj15-Jul-19
Emp1Proj18-Jul-19
Emp1Proj29-Jul-19
Emp1Proj210-Jul-19
Emp1Proj211-Jul-19
Emp1Proj212-Jul-19
Emp1Proj215-Jul-19
Emp1Proj216-Jul-19
Emp1Proj217-Jul-19
Emp1Proj218-Jul-19
Emp1Proj219-Jul-19
Emp1Proj324-Jul-19
Emp1Proj325-Jul-19
Emp1Proj326-Jul-19

 

I need to filter that data and get the MinDate and MaxDate per Employee, Per Project (everything is in the same table, tried creating Calculate(Min(Timesheedate),Filter(TableA,Groupby(empname)), it's giving circular dependency error).

 

Final expected output should be,

 

EmpNameProjNameMinDateMaxDate
Emp1Proj11-Jul-198-Jul-19
Emp1Proj29-Jul-1919-Jul-19
Emp1Proj324-Jul-1926-Jul-19

 

Need help!

1 ACCEPTED SOLUTION

Accepted Solutions
HotChilli New Contributor
New Contributor

Re: Filter Group By in Same table

Drag EmpName and ProjName on to a table visualisation.

Then drag TimeSheetDate on to the same table twice.

In the Values field well, click the dropdown on the first TimeSheetDate, choose Earliest.

Click the dropdown on the secondTimeSheetDate, choose Latest.

You can change the date format by choosing TimeSheetDate instead of Date Hierarchy from the same dropdown.

View solution in original post

3 REPLIES 3
HotChilli New Contributor
New Contributor

Re: Filter Group By in Same table

Drag EmpName and ProjName on to a table visualisation.

Then drag TimeSheetDate on to the same table twice.

In the Values field well, click the dropdown on the first TimeSheetDate, choose Earliest.

Click the dropdown on the secondTimeSheetDate, choose Latest.

You can change the date format by choosing TimeSheetDate instead of Date Hierarchy from the same dropdown.

View solution in original post

AClerk New Contributor
New Contributor

Re: Filter Group By in Same table

Hi @slanka 

Here is my solution

Create 3 new columns:

Column MAX = 
CALCULATE ( MAX ( T15[TimesheetDate] ), ALLEXCEPT ( T15, T15[EmpName],T15[ProjName] ) )
Column Min = 
CALCULATE ( MIN( T15[TimesheetDate] ), ALLEXCEPT ( T15, T15[EmpName],T15[ProjName] ) )
NOT Mandatory, just for debugging
MIN_MAX = IF(T15[Column MAX] = T15[TimesheetDate] || T15[Column Min] = T15[TimesheetDate], 1,0)

Create a new table:

T16 = 
SUMMARIZE(T15,T15[EmpName], T15[ProjName], T15[Column MAX],T15[Column Min])

2019-07-19 09_31_44-papercut - Remote Desktop Connection.png

 

Good Luck!
A

Highlighted
slanka Regular Visitor
Regular Visitor

Re: Filter Group By in Same table

Thanks for the trick Smiley Happy it worked!

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 99 members 1,570 guests
Please welcome our newest community members: