Forum Discussion
Use Date Table to Filter Dimension Employee Table
Hello,
I am currently try to build a more intelligent way to view some of our reports that way it can incorporate historical data, instead of only showing current data.
I have a dimension employee table with historical records of changes (position, employment status, supervisor, etc.) which is the lens we use to analyze some of our fact tables. Currently in most of our reports we use a table that only pulls in Status = Active and CurrentRow = Y employees, which gives us one record for each active employee and is the current record.
| Name | Position | Status | Supervisor | Start Date | End Date | Current Row |
| Bob | ABC | Active | Emma | 1/1/2021 | 12/31/2021 | N |
| Bob | DEF | Active | Emma | 1/1/2022 | 12/31/9999 | Y |
| Mary | ABC | Active | Joe | 1/1/2021 | 10/31/2021 | N |
| Mary | ABC | Active | James | 11/1/2021 | 12/31/9999 | Y |
| James | GHI | Active | Anna | 1/1/2021 | 6/30/2021 | N |
| James | JKL | Active | Anna | 7/1/2021 | 12/31/9999 | Y |
| Tom | GHI | Active | Anna | 7/1/2021 | 12/31/9999 | Y |
In general, this works well, but it only allows user to look at current data.
I would like to be able to join this table with a date table, so that you can filter using other time metrics. My hope is to build something that utilizes the employee start and end date instead of Current Row. The employee status will still be used as if an employee is terminated the status will be terminated, but the Current Row will be Y.
For example, filter the date table by 2021 and show all of the employees for that year with the other related info like position. Then you could change to 2022 and see any of the updated info.
For the example data I provided above if you filtered by 2021 you would see that Bob's position is ABC, but if you filtered by 2022 you would see he changed positions to DEF.
Any suggestions on how to accomplish this would be much appreciated.
Hi, mbwseco ;
You could create a new date table :
Date = CALENDAR(MIN('Table'[Start Date]),DATE(2022,12,31))then create a measure.
Measure = IF(MAX('Date'[Date])>=MAX('Table'[Start Date])&&MAX('Date'[Date])<=MAX('Table'[End Date]),"Y","N")The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
1 Reply
- v-yalanwu-msftCommunity Support
Hi, mbwseco ;
You could create a new date table :
Date = CALENDAR(MIN('Table'[Start Date]),DATE(2022,12,31))then create a measure.
Measure = IF(MAX('Date'[Date])>=MAX('Table'[Start Date])&&MAX('Date'[Date])<=MAX('Table'[End Date]),"Y","N")The final show:
Best Regards,
Community Support Team _ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.