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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Hired and fired on one visual

Hi,

 

i have a table which contains one line per employee and multiple columns included one for the hire date and one for the termination date.

I also have a "date" table.

 

I want to have in the same visual the number of hired employees and the number of terminated employees per month

it seems very simple but i don't find the solution.

if someone could help me....

 

Thanks

1 ACCEPTED SOLUTION

@Anonymous Create a relationship between both dates to your main date table.

two relationships.PNG

In this instance the "Fire Date" is the active relationship so you can use a count of people or create a simple measure

Fire = COUNTA('Table'[Person]) and that will inherit and use the active relationship. For the other relationship we need to specify that you want to use the inactive relationship so your measure would look something like this -> 
Hire = CALCULATE(COUNTA('Table'[Person]), USERELATIONSHIP('Date'[Date],'Table'[Hire Date]))
Then in your visual, you can use the single Date column from the Date dimension and the calculations would use the appropriate date filter.

Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG

View solution in original post

3 REPLIES 3

@Anonymous Create a relationship between both dates to your main date table.

two relationships.PNG

In this instance the "Fire Date" is the active relationship so you can use a count of people or create a simple measure

Fire = COUNTA('Table'[Person]) and that will inherit and use the active relationship. For the other relationship we need to specify that you want to use the inactive relationship so your measure would look something like this -> 
Hire = CALCULATE(COUNTA('Table'[Person]), USERELATIONSHIP('Date'[Date],'Table'[Hire Date]))
Then in your visual, you can use the single Date column from the Date dimension and the calculations would use the appropriate date filter.

Looking for more Power BI tips, tricks & tools? Check out PowerBI.tips the site I co-own with Mike Carlo. Also, if you are near SE WI? Join our PUG Milwaukee Brew City PUG
Anonymous
Not applicable

thank you, it works, i juste dicover the USERELARTIONSHIP!

Nathaniel_C
Super User
Super User

Hi @Anonymous ,

If the date table is related to the other table, you should be able to drop it a visual like a table or matrix (assuming you have a monthname in the table, then create a measure COUNT(table[hired date]) and another COUNT(table[fired date]).  The monthname will filter the two measures so that you only get each months count. Of course, use your table and column names in the formula.


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.