Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
bethf
Frequent Visitor

SQL Semi annual due date

Hello,  I need to calculate a semi annual date due date based on an issue date. 

I have a case statement for Annual and Quarterly but wondering if there is a statement that would calcualte semi annual?

 

case when ps.PaymentMode = 'Annual' then
   case when (DATEADD(year, datediff(year, ps.[IssueDate], getdate()), ps.IssueDate ) > getdate() )
   then dateadd(year, datediff(year, ps.issuedate, getdate()), ps.issuedate)
   else dateadd(year, datediff(year, ps.issuedate, getdate())+1, ps.issuedate) end
 
   Else
  case when ps.paymentmode = 'Quarterly' then
   case when (dateadd(quarter, datediff(quarter, ps.issuedate, getdate()), ps.issuedate) > getdate() )
   then dateadd(quarter, datediff(quarter, ps.issuedate, getdate()), ps.issuedate)
  else dateadd(quarter, datediff(quarter, ps.issuedate, getdate())+1, ps.issuedate)  end

   end
   end as 'Premium Due Date'

 

Thanks!

1 ACCEPTED SOLUTION
dax
Community Support
Community Support

Hi  @bethf , 

It seems that you want to get result of last or next 6 months based on today, right? Ifso, you could try to use relative date slicer or use measure to achieve this goal. You could refer to my sample for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@bethf ,The information you have provided is not making the problem clear to me. Can you please explain with an example.
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
Appreciate your Kudos.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

So what I am trying to acheive is an semi annual due date. 

For example if today is 6/24/2020 and the issue date was 1/1/2020 then the next semi annual date would be 1/1/2021, given that the first semi annual due date,6/1/2020, has already passed. Does that make sense?

This would be in SQL that I would then pass to PBI.

 

 

 

dax
Community Support
Community Support

Hi  @bethf , 

It seems that you want to get result of last or next 6 months based on today, right? Ifso, you could try to use relative date slicer or use measure to achieve this goal. You could refer to my sample for details.

Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

dax
Community Support
Community Support

Hi @bethf , 

I am not sure your requirement, did you want to use powerbi to get the result or you just use SQL code to achieve this? If possible, could you please inform me more detailed information(such as your expected output and your sample data)? Then I will help you more correctly.

Please do mask sensitive data before uploading.

Thanks for your understanding and support.
Best Regards,
Zoe Zhi

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

bethf
Frequent Visitor

So what I am trying to acheive is an semi annual due date. 

For example if today is 6/24/2020 and the issue date was 1/1/2020 then the next semi annual date would be 1/1/2021, given that the first semi annual due date,6/1/2020, has already passed. Does that make sense?

This would be in SQL that I would then pass to PBI

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.