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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
MarcF142
New Member

calculating number of days two tech work on the same job

hi 

I am trying to find the number of days two techs or more is working on the same job.

I try Pivot Table and =Countifs I can not seem to make it work.

Does anyone have an idea?

regards

 

Job #             Tech name            day of work

20593Tony28-Jan-21
20593Paul28-Jan-21
20593Tony29-Jan-21
20593Paul29-Jan-21
20906Byron19-Jan-21
20906Jason19-Jan-21
20906Byron20-Jan-21
20906Jason20-Jan-21
20906Byron21-Jan-21
20906Jason21-Jan-21
20906Byron22-Jan-21
20906Jason22-Jan-21
20947SANDOR5-Jan-21
20947Brayden19-Jan-21
20947Tony19-Jan-21
20947Andy20-Jan-21
20947Tony20-Jan-21
20947Brayden22-Jan-21
20947SANDOR22-Jan-21
20947Andy22-Jan-21
20995Andy25-Jan-21
20995Guy25-Jan-21
2 ACCEPTED SOLUTIONS

let
Source = Excel.Workbook(File.Contents("C:\Users\johndoe\Documents\John Changes Sept 2021\2021 FM report of data\test data for blog.xlsx"), null, true),
Table2_Table = Source{[Item="Table2",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Table2_Table,{{"hDocketNumber", Int64.Type}, {"First Name", type text}, {"date_of_report", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"hDocketNumber", "Job #"}, {"First Name", "Tech name"}, {"date_of_report", "day of work"}}),
#"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns",{{"Tech name", type text}, {"day of work", type date}}),
Custom1 = Table.Group(#"Changed Type1",{"Job #","day of work"},{"Tech Count",each List.Count(List.Distinct([Tech name]))}),
Custom2 = Table.Group(Custom1,"Tech Count",{"days",Table.RowCount})
in
Custom2

View solution in original post

smpa01
Super User
Super User

@MarcF142  achievable in DAX with this measure

Measure = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[date] ),
    ALLEXCEPT ( 'Table', 'Table'[job], 'Table'[name] )
)

 

smpa01_0-1640745836483.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs

View solution in original post

6 REPLIES 6
v-angzheng-msft
Community Support
Community Support

Hi, @MarcF142 

May I ask if your problem has been solved? Is the above post helpful to you?

If  it does, could you please mark the post which help as Answered? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.

 

 

Best Regards,
Community Support Team _ Zeon Zheng

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

smpa01
Super User
Super User

@MarcF142  achievable in DAX with this measure

Measure = 
CALCULATE (
    DISTINCTCOUNT ( 'Table'[date] ),
    ALLEXCEPT ( 'Table', 'Table'[job], 'Table'[name] )
)

 

smpa01_0-1640745836483.png

 

Did I answer your question? Mark my post as a solution!
Proud to be a Super User!
My custom visualization projects
Plotting Live Sound: Viz1
Beautiful News:Viz1, Viz2, Viz3
Visual Capitalist: Working Hrs
wdx223_Daniel
Super User
Super User

wdx223_Daniel_0-1640673644914.png

wdx223_Daniel_1-1640673657195.pngwdx223_Daniel_2-1640673666274.png

let
    Source = Table.TransformColumns(Excel.CurrentWorkbook(){[Name="Table2"]}[Content],{"day of work",each Date.From(_,"en-us")}),
    Custom1 = Table.Group(Source,{"Job #","day of work"},{"Tech Count",each List.Count(List.Distinct([Tech name]))}),
    Custom2 = Table.Group(Custom1,"Tech Count",{"days",Table.RowCount})
in
    Custom2

 

thank you, wdx223_Daniel

 

the answer is really what I was looking for, however, I cant seem to make it work the same as you.

the advance editor sees no error.

 

let
Source = Excel.Workbook(File.Contents("C:\Users\johndoe\Documents\John Changes Sept 2021\2021 FM report of data\test data for blog.xlsx"), null, true),
Table2_Table = Source{[Item="Table2",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Table2_Table,{{"hDocketNumber", Int64.Type}, {"First Name", type text}, {"date_of_report", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"hDocketNumber", "Job #"}, {"First Name", "Tech name"}, {"date_of_report", "day of work"}}),
#"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns",{{"Tech name", Int64.Type}, {"day of work", type date}}),
Custom1 = Table2.Group(Source,{"Job #","day of work"},{"Tech Count",each List.Count(List.Distinct([Tech name]))}),
Custom2 = Table2.Group(Custom1,"Tech Count",{"days",Table.RowCount})
in
#"Changed Type1"

 

 

I know my source file is different but this should not be a problem.

I see the Table load window open and it flashes Data updated but it never opens in my Workbook.

instead, I get this error message.

 

MarcF142_0-1640716879110.png

 

MarcF142_1-1640717166581.png

 

 I don't see how "Table2.Group" wasn't recognized if the editor see no error?

any idea what I a doing wrong?

let
Source = Excel.Workbook(File.Contents("C:\Users\johndoe\Documents\John Changes Sept 2021\2021 FM report of data\test data for blog.xlsx"), null, true),
Table2_Table = Source{[Item="Table2",Kind="Table"]}[Data],
#"Changed Type" = Table.TransformColumnTypes(Table2_Table,{{"hDocketNumber", Int64.Type}, {"First Name", type text}, {"date_of_report", type date}}),
#"Renamed Columns" = Table.RenameColumns(#"Changed Type",{{"hDocketNumber", "Job #"}, {"First Name", "Tech name"}, {"date_of_report", "day of work"}}),
#"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns",{{"Tech name", type text}, {"day of work", type date}}),
Custom1 = Table.Group(#"Changed Type1",{"Job #","day of work"},{"Tech Count",each List.Count(List.Distinct([Tech name]))}),
Custom2 = Table.Group(Custom1,"Tech Count",{"days",Table.RowCount})
in
Custom2
askhanduja
Helper I
Helper I

Hi,

 

Please see solution file here.

 

The solution looks like this:

 

askhanduja_0-1640672799107.png

 

If this solves your problem please consider marking this post as the solution so that others with a similar problem may find the answer easily. A thumbs would also be greatly appreciated.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.