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,
I have a date column which I've added to a table. I want to see the earliest & latest dates do I've added this column twice.
How do I find the number of days between the earliest & latest dates. See pic.
Thanks,
android1
Solved! Go to Solution.
hi @android1
I would create 2 measures to calculate the Start and End Date
Maximum Date = calculate(max([A/ Leave Date]))
Minimum Date = calculate(min([A/ Leave Date]))
Then a 3rd measure
difference = datediff([Minimum Date],[Maximum Date],DAY)
if your table has multiple rows for employee absence/attendance this method will only take the first and last date for that and calculate the days in between,
difference = IF([Minimum Date] = [Maximum Date],1,datediff([Minimum Date],[Maximum Date],DAY))
hi @android1
I would create 2 measures to calculate the Start and End Date
Maximum Date = calculate(max([A/ Leave Date]))
Minimum Date = calculate(min([A/ Leave Date]))
Then a 3rd measure
difference = datediff([Minimum Date],[Maximum Date],DAY)
if your table has multiple rows for employee absence/attendance this method will only take the first and last date for that and calculate the days in between,
Yeah, that works real good. Thanks.
One problem tho. If my min date is the same as my max date I want the difference to be 1 day.
So if min is 29/01/18 & max is 29/01/18 then difference needs to be 1 day.
difference = IF([Minimum Date] = [Maximum Date],1,datediff([Minimum Date],[Maximum Date],DAY))
Thats brilliant. Thanks very much.
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 |
---|---|
106 | |
93 | |
75 | |
62 | |
50 |
User | Count |
---|---|
147 | |
107 | |
105 | |
87 | |
61 |