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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
ABC11
Resolver I
Resolver I

Sum of total hrs to get Headcount by Area, valuesteam,...

Hello,

I would like to have headcount by area, valuestream, businessunit

I added column to get employee total hrs for that day(without breaking into area, valuestream,businessunit) but getting incorrect(see- in bold, Italic,underline)

 
Employee Total Hrs =
VAR _VendorName=Query1[VENDOR_NAME]
VAR _RowHours=Query1[LABORHRS]
VAR _LaborCode=Query1[LABORCODE]
VAR _Workdate=Query1[WORKDATE]
VAR _Calc=
CALCULATE(
SUM(Query1[LABORHRS]),
FILTER(ALL(Query1),Query1[VENDOR_NAME]=_VendorName && Query1[LABORCODE]=_LaborCode && Query1[WORKDATE]=_Workdate)
)
Return
_Calc
VENDOR_NAMELABORCODECONTRACTOR_NAMEWORKDATEAREA_NEWVALUESTREAMBUSINESSUNITLABORHRSEmployee Total Hrs
ABC 30002594A GEREMY12/1/2022H1 BPHZ EXTRACTION & TAILINGS2809005.511
ABC 30002594A GEREMY12/1/2022H1 U2HZ UTILITIES677000511
ABC 30002594A GEREMY12/1/2022H1 U2HZ VP AND SUPPORT - U23009150.511
ABC 30002594A GEREMY12/12/2022H1 MINIHZ MINE GENERAL1001201111.5
ABC 30002594A GEREMY12/12/2022H1 U2HZ VP AND SUPPORT - U23009150.511.5
ABC 30002594A GEREMY12/13/2022H1 MINIHZ MINE GENERAL1001201111.5
ABC 30002594A GEREMY12/13/2022H1 U2HZ VP AND SUPPORT - U23009150.511.5
ABC 30002594A GEREMY12/14/2022H1 MINIHZ MINE GENERAL1001201111.5
ABC 30002594A GEREMY12/14/2022H1 U2HZ VP AND SUPPORT - U23009150.511.5
ABC 30002594A GEREMY12/15/2022H1 MINIHZ MINE GENERAL10012010.511
ABC 30002594A GEREMY12/15/2022H1 U2HZ VP AND SUPPORT - U23009150.511
ABC 30002595A MICHAEL12/2/2022H1 U2HZ PUG3300001429
ABC 30002595A MICHAEL12/2/2022H1 U2HZ VP AND SUPPORT - U23009150.514.5
ABC 30002595A MICHAEL12/3/2022H1 U2HZ PUG330000413
ABC 30002595A MICHAEL12/3/2022H1 U2HZ UTILITIES640000413
ABC 30002595A MICHAEL12/3/2022H1 U2HZ UTILITIES6500004.526
ABC 30002595A MICHAEL12/3/2022H1 U2HZ VP AND SUPPORT - U23009150.513
ABC 30002595A MICHAEL12/4/2022H1 U2HZ PUG3300001111.5
ABC 30002595A MICHAEL12/4/2022H1 U2HZ VP AND SUPPORT - U23009150.511.5
ABC 30002595A MICHAEL12/5/2022H1 U2HZ UTILITIES7300001111.5
ABC 30002595A MICHAEL12/5/2022H1 U2HZ VP AND SUPPORT - U23009150.511.5
ABC 30002595A MICHAEL12/6/2022H1 U2HZ PUG3300001111.5
ABC 30002595A MICHAEL12/6/2022H1 U2HZ VP AND SUPPORT - U23009150.511.5
ABC 30002595A MICHAEL12/7/2022H1 U2HZ PUG3300001111.5
ABC 30002595A MICHAEL12/7/2022H1 U2HZ VP AND SUPPORT - U23009150.511.5
ABC 30002595A MICHAEL12/8/2022H1 U2HZ PUG33000010.511
ABC 30002595A MICHAEL12/8/2022H1 U2HZ VP AND SUPPORT - U23009150.511
ABC 30002595A MICHAEL12/16/2022H1 U2HZ VP AND SUPPORT - U23009150.511.5
ABC 30002595A MICHAEL12/16/2022TA-OPEXHZ UPGRADING4900001111.5
ABC 30002595A MICHAEL12/17/2022H1 U2HZ UTILITIES760000929
ABC 30002595A MICHAEL12/17/2022H1 U2HZ VP AND SUPPORT - U23009150.514.5
ABC 30002595A MICHAEL12/17/2022TA-OPEXHZ UPGRADING490000514.5
Thanks
1 ACCEPTED SOLUTION
Shaurya
Memorable Member
Memorable Member

Hi @ABC11,

 

You can try creating a DAX column for this using:

 

Sum = SUMX('TableName',IF(_VendorName=EARLIER(_VendorName) && _RowHours=EARLIER(_RowHours) && _LaborCode=EARLIER(_LaborCode && _Workdate=EARLIER(_Workdate),'TableName'[Hours],0))

 

Works for you? Mark this post as a solution if it does!
Check out this blog of mine: How to Export Telemetry Data from Azure IoT Central into Power BI

View solution in original post

6 REPLIES 6
ABC11
Resolver I
Resolver I

Hello to All,

I need help here. can anybody help me or do I have to post as new

Please

Thanks

ABC11
Resolver I
Resolver I

Hello To all,

I need help on this-do I have to post it as new or someone can help me here

Please

Thanks

ABC11
Resolver I
Resolver I

Above formula is working perfectly

Thanks

Shaurya
Memorable Member
Memorable Member

Hi @ABC11,

 

You can try creating a DAX column for this using:

 

Sum = SUMX('TableName',IF(_VendorName=EARLIER(_VendorName) && _RowHours=EARLIER(_RowHours) && _LaborCode=EARLIER(_LaborCode && _Workdate=EARLIER(_Workdate),'TableName'[Hours],0))

 

Works for you? Mark this post as a solution if it does!
Check out this blog of mine: How to Export Telemetry Data from Azure IoT Central into Power BI

Happy New Year Shaurya,

would you please, help me here.

Thanks,

Hello Shaurya,

Sorry it didn't work. would you please take a look again.

Thanks for your time

Helpful resources

Announcements
Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.