cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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.

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.

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

slanka Regular Visitor
Regular Visitor

Re: Filter Group By in Same table

Thanks for the trick Smiley Happy it worked!

Helpful resources

Announcements
Back to School Contest

Back to School Contest

Engage and empower students with Power BI!

MBAS Gallery

Watch Sessions On Demand!

Continue your learning in our online communities.

Summit Australia 2019

Summit Australia 2019

Travel to Melbourne and network with thousands of peers!

PBI Community Highlights

PBI Community Highlights

Check out what's new in the Power BI Community!

Top Ideas
Users Online
Currently online: 27 members 900 guests
Please welcome our newest community members: