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

USERELATIONSHIP with Date slicer

Hi,

 

I'm having trouble with my date slicer to coincide with the measures I have in a clustered column chart.

 

Goal - I want to see on the clustered column chart, 2 measures: people who start, 'Starters', and people who left the company, 'Leavers'. These are on the Y axis. The area of the company they left is on the X axis.

 

Measures being used:

 

Starters =
var startermeasure = calculate(DISTINCTCOUNT('All Postholding w/ Projected End Date History'[Employee Number]), 'All Postholding w/ Projected End Date History'[starter] = 1)
var starterempstartdate = CALCULATE(startermeasure, USERELATIONSHIP('Date'[Date],'All Postholding w/ Projected End Date History'[Emp Start Date]))

return starterempstartdate
 
Leavers =
var leavermeasure = calculate(DISTINCTCOUNT('All Postholding w/ Projected End Date History'[Employee Number]), 'All Postholding w/ Projected End Date History'[leaver] = 1)
var leaverempenddate = CALCULATE(leavermeasure, USERELATIONSHIP('Date'[Date],'All Postholding w/ Projected End Date History'[ph end Date]))

return leaverempenddate
 
Here is the data model, 'Date'[Date] column with active relationship to 'All Postholding w/ Projected End Date History'[Original Start Date] and inactive relationships for measures above to work:

 

dannyHE_0-1652881919530.png

 

The measures seem to work, but the issue is when I put a date slicer on the page; as it's still using whichever relationship is active, it's filtering the visuals to the incorrect numbers; e.g: if the 'Dates'[Date] to 'All Postholding w/ Projected End Date History'[ph end Date] is active, the leavers number is correct but the starters is wrong and I get the following:

 

dannyHE_5-1652883031037.png

S= Starters, L = Leavers

dannyHE_6-1652883162157.png

Drill-through to a 'Leavers - Data' page where the 'Leavers' measure goes to and has table above

 

 

But then if Date'[Date] to 'All Postholding w/ Projected End Date History'[Emp Start Date] relationship is active I get the following:

 

dannyHE_4-1652882942257.png

 

dannyHE_3-1652882881490.png

Drill-through to a 'Starters - Data' page where the 'Starters' measure goes to and has table above.

 

 

How do I get the date slicer to just let me pick between two dates, and I get the correct number of starters or leavers on the column chart, and when I right-click drill-through, the relevant measure I'm drilling through with takes me to the appropriate page with the right data?

 

Thanks in advance, I hope all the information is clear enough!

 

 

 

 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Refer my blog on the same topic

https://community.powerbi.com/t5/Community-Blog/HR-Analytics-Active-Employee-Hire-and-Termination-trend/ba-p/882970

 

Attached file after signature if needed

 

Anonymous
Not applicable

thanks @amitchandak 

 

I don't think I wrote the DAX in the measures to be optimal, but your article got me to a working solution 👍

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.

Top Solution Authors