Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!View all the Fabric Data Days sessions on demand. View schedule
Hi,
I am trying to write a measure which looks for the last date where there is a value greater than 0.
I have a calendar table linked on date to a timesheet hours table. In the below table I have got my target measure in the 'Previous Date with Hours > 0', which would find the last date (and before the current date) where the Hours is greater than 0. So that means on Date 13/05 where there is 0 Hours, the Previous Date with Hours > 0 is 06/05, and on 20/05 the Previous Date with Hours >0 is also 06/05, because of the 0 hours in the previous week of 13/05.
Hopefully that makes sense!
Many thanks for any help
| Date | Hours | Previous Date with Hours > 0 |
| 01/04/2024 | 5752 | |
| 08/04/2024 | 01/04/2024 | |
| 15/04/2024 | 6407 | 01/04/2024 |
| 22/04/2024 | 6635 | 15/04/2024 |
| 29/04/2024 | 22/04/2024 | |
| 06/05/2024 | 6130 | 22/04/2024 |
| 13/05/2024 | 06/05/2024 | |
| 20/05/2024 | 6402 | 06/05/2024 |
| 27/05/2024 | 5443 | 20/05/2024 |
| 03/06/2024 | 6091 | 27/05/2024 |
| 10/06/2024 | 6543 | 03/06/2024 |
Solved! Go to Solution.
Hi,
You can replace the table with calendar reference so like this:
Proud to be a Super User!
Hi,
Here is one way to do this:
The measure returns same values as your example.
Proud to be a Super User!
Hi @ValtteriN
thank you for getting back to me, much appreciated. That does achieve the correct result if it is for a single table, but this wouldn't work if I get the date from the date table. The model would be something like the below with the timesheets table linked to the date table (here called Calendar). Do you know a way to achieve the same result but using a linked date table?
Many thanks
Hi,
You can replace the table with calendar reference so like this:
Proud to be a Super User!
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
| User | Count |
|---|---|
| 13 | |
| 9 | |
| 9 | |
| 5 | |
| 3 |
| User | Count |
|---|---|
| 28 | |
| 20 | |
| 19 | |
| 19 | |
| 12 |