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.
Hi Folks,
I need to build 2 dynamic measures which will allow me to assess if an employee was/is working within a time period.
The time period in questions, being dictated by the Min & Max Date of a slicer.
I have two tables.
A Timecard table with the Dataset and a Date Table for the slicer.
I do not want to relate.
On the Timecard table there are employee records with columns of start and end date.
If Finish Date is blank, it means they are still employees.
I need a nested if measuse using the Slicer Max And Min Dates. Once I get one example of the "IF" pulling the max and min values from the slicer into the measure, I should be able to work out all the scenarios.
I basically need 2 measures, call "Start Date" and "End Date", that works out for instance:
If the Employee start date is before the Slicer Min Date and the Employee End Date is blank.
Then the Start Date is the Slicer Min and the End Date is the Slicer Max Date.
Any help would be appreciated.
Solved! Go to Solution.
Hi @Brianoreilly,
We can create the measures as below to achieve your goal.
Start Date = VAR mindate = MIN ( 'date'[Date] ) RETURN IF ( ISBLANK ( MAX ( 'dataset'[Employee End Date] ) ) && MAX ( 'dataset'[Employee Start Date] ) < mindate, mindate, MAX ( 'dataset'[Employee Start Date] ) )
End Date = VAR maxdate = MAX ( 'date'[Date] ) VAR mindate = MIN ( 'date'[Date] ) RETURN IF ( ISBLANK ( MAX ( 'dataset'[Employee End Date] ) ) && mindate >= MAX ( 'dataset'[Employee Start Date] ), maxdate )
Also please find the pbix as attached.
Regards,
Frank
Hi @Brianoreilly,
We can create the measures as below to achieve your goal.
Start Date = VAR mindate = MIN ( 'date'[Date] ) RETURN IF ( ISBLANK ( MAX ( 'dataset'[Employee End Date] ) ) && MAX ( 'dataset'[Employee Start Date] ) < mindate, mindate, MAX ( 'dataset'[Employee Start Date] ) )
End Date = VAR maxdate = MAX ( 'date'[Date] ) VAR mindate = MIN ( 'date'[Date] ) RETURN IF ( ISBLANK ( MAX ( 'dataset'[Employee End Date] ) ) && mindate >= MAX ( 'dataset'[Employee Start Date] ), maxdate )
Also please find the pbix as attached.
Regards,
Frank
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
108 | |
100 | |
78 | |
64 | |
58 |
User | Count |
---|---|
148 | |
113 | |
97 | |
84 | |
67 |