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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
slanka
Helper I
Helper I

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
HotChilli
Super User
Super User

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
Anonymous
Not applicable

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

HotChilli
Super User
Super User

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.

Thanks for the trick 🙂 it worked!

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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