Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more
Hi,
Very new to Power BI but I have been working with SQL Server SSAS (and SSIS) for a few years.
I'm trying to build a dataset from a sql view, which seemed simple enough but, it's starting to give me a headache.
The view return a list of all company employees, with an employment start and end date. The end date is null if the employee is still employed, obviously.
What i'm trying to acheive is a couple of cards and a date slicer. First card is showing to number of employees who started their employment, the other, the number of employees who's employment was terminated, all within a certain range of dates (I do have a datamart date table used in a olap cube).
I first tried to link both dates to the date table but soon realized one relationship was deactivated.
I then tried creating a second date table, from the datamart table, to link the second date from the employee table. No luck. It seem that all dates related to the second set, were showing a null date (1900-01-01).
I also tried creating a calculated column using Count and USERELATIONSHIP but somehow that failed too.
Any hints on how to create this? Was I on the right track at one point but was just missing something?
Solved! Go to Solution.
Hi @emenard
Try the following steps.
1. The date ( calendar) dimension table should not be linked to the employee table.
2. Create the meassure
Started = CAlculate(Countrows(HRTable), FIlter (HRTable,HRTable[Employment start] >= Min('Calendar'[Date]) && HRTable[Employment start]<= MAx('Calendar'[Date])))
3. Ended = CAlculate(Countrows(HRTable), FIlter (HRTable,HRTable[Employment end] >= Min('Calendar'[Date]) && HRTable[Employment end]<= MAx('Calendar'[Date])))
4. Replace the HRTable with your employee table name and Calendar with your date dimension table.
5. Sample output based on the sample data.
If this works for you please accept this as solution and also give KUDOS.
Cheers
CheenuSing
Hi @emenard,
I have a different solution. Relate either start date or end date with date column of your dimension table and create these two measures. Thats it!
EmploymentStarted = CALCULATE(COUNT('Fact'[Employee]),FILTER('Fact','Fact'[End Date] = BLANK()))EmploymentEnded = CALCULATE(COUNT('Fact'[Employee]),FILTER('Fact','Fact'[End Date] <> BLANK()))Replace 'Fact' with your table name.
Prateek Raina
Thanks for all the help guys. Tried both solutions... works really well.
Thanks @v-ljerr-msft for the sample file. Helped me out figuring some stuff out.
Hi @emenard,
I have a different solution. Relate either start date or end date with date column of your dimension table and create these two measures. Thats it!
EmploymentStarted = CALCULATE(COUNT('Fact'[Employee]),FILTER('Fact','Fact'[End Date] = BLANK()))EmploymentEnded = CALCULATE(COUNT('Fact'[Employee]),FILTER('Fact','Fact'[End Date] <> BLANK()))Replace 'Fact' with your table name.
Prateek Raina
 
					
				
		
Hi @emenard
It is doable. Can you please post some sample data in excel format on one drive and share the link.
Cheers
CheenuSing
Hi @emenard
Try the following steps.
1. The date ( calendar) dimension table should not be linked to the employee table.
2. Create the meassure
Started = CAlculate(Countrows(HRTable), FIlter (HRTable,HRTable[Employment start] >= Min('Calendar'[Date]) && HRTable[Employment start]<= MAx('Calendar'[Date])))
3. Ended = CAlculate(Countrows(HRTable), FIlter (HRTable,HRTable[Employment end] >= Min('Calendar'[Date]) && HRTable[Employment end]<= MAx('Calendar'[Date])))
4. Replace the HRTable with your employee table name and Calendar with your date dimension table.
5. Sample output based on the sample data.
If this works for you please accept this as solution and also give KUDOS.
Cheers
CheenuSing
But its not working at months level, showing same values as year
But its not working at month level. showing same number at month level also
 
					
				
				
			
		
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.
 
            | User | Count | 
|---|---|
| 85 | |
| 49 | |
| 36 | |
| 31 | |
| 30 |