cancel
Showing results for
Did you mean:

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Frequent Visitor

## Sales VS Attendance

hello,

got time attendance machine and sales and I would like to see which employee was in office during the particular sale.

here is screen how i see it.

1 ACCEPTED SOLUTION
Community Champion

Change the calculated column as under

Salesmen =
VAR CurrentTime =
FORMAT ( Sales[Time], "HH:MM" )
VAR SalesPerson =

CALCULATETABLE (
SUMMARIZE ( Attendance, Attendance[Employee] ),
CurrentTime >=FORMAT ( ( Attendance[IN] ), "HH:MM" ),
CurrentTime <=FORMAT ( ( Attendance[OUT] ), "HH:MM" )
)
RETURN
CONCATENATEX ( SalesPerson, [Employee], "," )

Let me know if it works.

Cheers

CheenuSing
Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
5 REPLIES 5
Community Champion

There is overlap of timing between the two employees.

So do you want show the names of both the sales person at the time of sale ??

Cheers

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
Frequent Visitor

Exactly

Community Champion

Here are the steps I followed

1. In the Attendance Table set the IN and OUT as TIME(HH:MM)

2. Sorted the Attendance Table by Employee

3. In the Sales Table set the TIme as TIME(HH:MM)

Added a calculated Column SalesMen  In SalesTable as
Salesmen =
VAR CurrentTime =
FORMAT ( Sales[Time], "HH:MM" )
VAR SalesPerson =
CALCULATETABLE (
SUMMARIZE (
UNION (
CALCULATETABLE (
SUMMARIZE ( Attendance, Attendance[Employee] ),
FORMAT ( ( Attendance[IN] ), "HH:MM" ) >= CurrentTime
),
CALCULATETABLE (
SUMMARIZE ( Attendance, Attendance[Employee] ),
CurrentTime <= FORMAT ( ( Attendance[OUT] ), "HH:MM" )
)
),
[Employee]
)
)
RETURN
CONCATENATEX ( SalesPerson, [Employee], "," )

Atttached the Pbix

Cheers

CheenuSing

Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!
Frequent Visitor

thanks!

but seem to be a little error. George shouldn't be in sales before 11:20 (time he came) and in your list he appears from the start (((

Community Champion

Change the calculated column as under

Salesmen =
VAR CurrentTime =
FORMAT ( Sales[Time], "HH:MM" )
VAR SalesPerson =

CALCULATETABLE (
SUMMARIZE ( Attendance, Attendance[Employee] ),
CurrentTime >=FORMAT ( ( Attendance[IN] ), "HH:MM" ),
CurrentTime <=FORMAT ( ( Attendance[OUT] ), "HH:MM" )
)
RETURN
CONCATENATEX ( SalesPerson, [Employee], "," )

Let me know if it works.

Cheers

CheenuSing
Did I answer your question? Mark my post as a solution and also give KUDOS !

Proud to be a Datanaut!

Announcements

#### New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

#### Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

#### Fabric certifications survey

Certification feedback opportunity for the community.

Top Solution Authors
Top Kudoed Authors