Oracle Analytics Cloud and Server

Welcome to the Oracle Analytics Community: Please complete your User Profile and upload your Profile Picture

Count number of weeks from a specific date

Closed
41
Views
6
Comments
Pawel X Dmochowski
Pawel X Dmochowski Rank 4 - Community Specialist

Summary

Count number of weeks from a specific date

Content

Hi,

I'm trying to create a measure which would tell me the number of weeks between a specified attribute (e.g. Week End Date) and a fixed date.

I tried to use WEEK_OF_YEAR but this function becomes an attribute! - so it's useless

 

Any help on this please? It sounds like a simple thing - yet I'm struggling with it for some time now.

 

Best regards,

Pawel.

Answers

  • [Deleted User]
    [Deleted User] Rank 7 - Analytics Coach

    TIMESTAMPDIFF(SQL_TSI_WEEK, some.date, someother.date)

  • Pawel X Dmochowski
    Pawel X Dmochowski Rank 4 - Community Specialist

    Actually - maybe this small picture will help explain better:

    Capture2.PNG

    As You can see in 3rd line the Count of Weeks is only 3 (because user didn't report time for 2 weeks) so his Utilization (Hrs/Count of Weeks) is Wrong.

    With weeks 2 - I'm playing to find a way so that e.g. for June - no matter how many weeks are reported by whom - the measure returned should always be 5.

    Regards,

    Pawel.

  • Pawel X Dmochowski
    Pawel X Dmochowski Rank 4 - Community Specialist

    Hi Christian,

    Well, the above also results in a Attribute (not a measure) and let me explain my issue in more detail.

    I have Week Ending date in my columns which I'm displaying as Months, Weeks, etc. So, I need to calculate the number of weeks between a fixed start date and the given week in my Week End Date column.

    The point here is I'm trying to calculate YTD utilization - meaning I need to know the total reported hrs so far (I got that already) + the total number of weeks*40 (regardless if the user reported any hours in a week or not). The problem is that if I count the Week End Dates (distinct) from the data - I sometime miss a timecard (e.g. when user if on vacation or off sick). This means, that my utilization calculation will be wrong!

    Hope it clarifies but I'm banging my head at this for days now

    Best regards,

    Pawel.

  • User_QXPKC
    User_QXPKC Rank 1 - Community Starter

    did you find an answer to this?

  • @User_QXPKC This is a 7 year old thread. Please open a new post with your question.

    thanks

    Gayathri

  • Gianni Ceresa
    edited Jun 9, 2025 7:38PM

    Hi @User_QXPKC ,

    Welcome to the Oracle Analytics community and forum.

    As suggested by @GayathriAnand-Oracle , it will be better if you post a new question, expressing your requirement, and also what product, and part of the product are you trying to achieve that.

    Closing this thread as it was migrated across a number of forum over the years…

    Thank you :)

This discussion has been closed.