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

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
gkalandadze
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. 333.png

1 ACCEPTED SOLUTION

@gkalandadze ,

 

Sorry about that

 

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!

View solution in original post

5 REPLIES 5
CheenuSing
Community Champion
Community Champion

Hi @gkalandadze 

 

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!

Exactly

Hi @gkalandadze ,

 

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!

thanks! 

 @CheenuSing 

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 (((

@gkalandadze ,

 

Sorry about that

 

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!

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

February 2024 Update Carousel

Power BI Monthly Update - February 2024

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

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.