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!Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.
In MS Report Builder, I'm trying to create a new Calculated Field (StartActAccrual) that renders the exact same results as this SQL Declare statement:
DECLARE @StartActAccrual FLOAT = 1.0 * Day(EOMONTH(@StartTapeDate,0)) / (SELECT CASE WHEN DAY(EOMONTH(DATEFROMPARTS(YEAR(@StartTapeDate),2,1))) = 29 THEN 366 ELSE 365 END)
Solved! Go to Solution.
Hi @dashmarley11 ,
For MS Report Builder, you can mimic that SQL logic in a calculated field, but the syntax will be a bit different since Report Builder uses Expressions (which are more like VB.NET). Here’s one way you could do it:
If your goal is to calculate the number of days in the month of @StartTapeDate divided by either 366 or 365 (based on if the year is a leap year), try something like this in your calculated field expression:
=Day(DateAdd("d", -1, DateAdd("m", 1, Fields!StartTapeDate.Value))) / (IIf(Day(DateSerial(Year(Fields!StartTapeDate.Value), 2, 29)) = 29, 366, 365))
Just make sure to replace Fields!StartTapeDate.Value with your actual field name if it’s different.
Let me know if you need help fitting this into your report or if you get any errors!
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
Translation & text editing supported by AI
Hi @dashmarley11 ,
For MS Report Builder, you can mimic that SQL logic in a calculated field, but the syntax will be a bit different since Report Builder uses Expressions (which are more like VB.NET). Here’s one way you could do it:
If your goal is to calculate the number of days in the month of @StartTapeDate divided by either 366 or 365 (based on if the year is a leap year), try something like this in your calculated field expression:
=Day(DateAdd("d", -1, DateAdd("m", 1, Fields!StartTapeDate.Value))) / (IIf(Day(DateSerial(Year(Fields!StartTapeDate.Value), 2, 29)) = 29, 366, 365))
Just make sure to replace Fields!StartTapeDate.Value with your actual field name if it’s different.
Let me know if you need help fitting this into your report or if you get any errors!
If my response resolved your query, kindly mark it as the Accepted Solution to assist others. Additionally, I would be grateful for a 'Kudos' if you found my response helpful.
Translation & text editing supported by AI
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.