Skip to main content

Notifications

Announcements

No record found.

Dynamics 365 general forum

How can I get swedish week number from a date in a reporting service report deployed online?

Posted on by

Hi,

I'm deploying a report to Dynamics 365 v9 (online)

In visual studio it's possible to do an expression like:
=DatePart(DateInterval.WeekOfYear, Fields!DateField.Value, FirstDayOfWeek.Monday, FirstWeekOfYear.FirstFourDays)

But when uploading the report to Dynamics I get an exception:
Microsoft.Crm.CrmReportingException: The report server has RDLSandboxing enabled and the Field expression for the dataset 'dsResult' contains a reference to a type, namespace, or member 'FirstDayOfWeek' that is not allowed. Change the expression to include only allowed namespaces, types, and members.


Without the FirstDayOfWeek and FirstWeekOfYear parameters DatePart function defaults to US settings it seems. 
For example: 2018-01-14 will give me week no 3 but in Sweden it should be 2.

FirstDayOfWeekValue
Type: Microsoft.VisualBasic.FirstDayOfWeek

Optional. A value chosen from the FirstDayOfWeek enumeration that specifies the first day of the week. If not specified, FirstDayOfWeek.Sunday is used.

FirstWeekOfYearValue
Type: Microsoft.VisualBasic.FirstWeekOfYear

Optional. A value chosen from the FirstWeekOfYear enumeration that specifies the first week of the year. If not specified, FirstWeekOfYear.Jan1 is used.


I have changed system settings/format  in Dynamics  first day of week and first week of year and have also specified language sv-SE in the report.

Is there another way?

Regards/Tomas

  • Verified answer
    Tomas Wall Profile Picture
    Tomas Wall on at
    RE: How can I get swedish week number from a date in a reporting service report deployed online?

    Ok,

    Looks like you can use the constants vbMonday and vbFirstFourDays online.

    =DatePart(DateInterval.WeekOfYear, Fields!DateField.Value, vbMonday, vbFirstFourDays)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,269 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans