Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

Search for a value using date ranges

$
0
0

I need to look up a value in one table based on date ranges. I have the following setup.

 

Table Watches

Date

Employee

Start

Stop

Department

 

Table Watches is a table showing when and where employees should work.

 

It contains the following fields:

  • Date is the date for the watch
  • Employee is the employee number to our employee who’s watch this is
  • Start is the time of day when the watch starts
  • Stop is the time of day when the watch ends
  • Department is the department where this watch takes place i.e. where the employee is working during this watch

 

Table Sales

Date

Employee

Time

Amount

 

Table Sales contains all the sales (transactions) and has the following fields:

  • Date which is the date when the transaction (sale) took place
  • Employee is the employeenumber to the employee who made the sale
  • Time is the time of day when the transaction (sale) took place
  • Amount is the amount

 

New Sales Table

Date

Employee

Time

Amount

Department

 

Because I also want to know in which department the transaction took place I want to look up the department from the Watches table and add that field to the Sales table, making it like described above.

 

I want to accomplish this by finding the Department in Watches where

  • Sales[Date] = Watches[Date]
  • Sales[Employee] = Watches[Employee]
  • Sales[Time] => Watches[Start] and Sales[Time]  <= Watches[ Stopp]

 

I am trying to use the LOOKUPVALUE()-function, but it only works (as far as I know) for testing fields with the same value not greater than or equal to and smaller than or equal to.

 

Can somebody please help me with this?


Viewing all articles
Browse latest Browse all 213819

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>