Convert "issue created date" to weekday name

Hi,
I’m trying to convert the issue created date to the name of weekday. For example, if an issue is created on 19 OCT 2022, the result should be “Wednesday”.

I tried creating a calculated measure using the Weekday function and the the issue property [Issue].CurrentMember.Get(‘Created at’). My calculated member looks like this:

Weekday([Issue].CurrentMember.Get(‘Created at’))

However, this results in the error "No function matches signature ‘Weekday()’ "
It looks like the data type of the issue property is not a date format.

Who can provide some tips?

Thanks,
Steven

Hello @steven.schouppe !

The error "No function matches signature ‘Weekday()’ " is a bit confusing. It shows you are calling Weekdays function without any parameters. Is it indeed like this or there’s something more displayed between open-close parenthesis? Because you explicitly wrote Weekday([Issue].CurrentMember[…]))…
image

Nevertheless, Weekdays() function expects a parameter of type DateTime. Get returns something else: a string! What you need to do is to convert that string into a DateTimeValue - by calling DateParse.

image

Note that Weekday() reeturns a number, you’ll need to do a Case statement to display the actual day name.
You may want to use the “Week Day” dimension instead - I suppose it comes with the plugin, as it is available in my environment without someone asking for it!

Here is my result - using both “Week day” dimenstion and “weekday” calculated measure.

See also Most active days by weeks and weekdays - Issues - Jira Demo - eazyBI . All reports in EazyBI Jira Demo account can.be exported/imported in your account and you’ll have countless calculated fields immediately available!

Hope it helps!
Vasile S.

2 Likes

Hi Vasile,

Works like a charm! Thanks a lot for the tip.
Here is the final caculated measure:

CASE
WHEN
 Weekday(DateParse([Measures].[Issue created date])) = 1
THEN
"Sunday"
WHEN
 Weekday(DateParse([Measures].[Issue created date])) = 2
THEN
"Monday"
WHEN
 Weekday(DateParse([Measures].[Issue created date])) = 3
THEN
"Tuesday"
WHEN
 Weekday(DateParse([Measures].[Issue created date])) = 4
THEN
"Wednesday"
WHEN
 Weekday(DateParse([Measures].[Issue created date])) = 5
THEN
"Thursday"
WHEN
 Weekday(DateParse([Measures].[Issue created date])) = 6
THEN
"Friday"
WHEN
 Weekday(DateParse([Measures].[Issue created date])) = 7
THEN
"Saturday"
END

Best regards,
Steven

2 Likes

Thanks for the great explanation @VasileS! Very much appreciated!

To add to the conversation, there is a possibility to shorten the CASE statement as follows:

CASE
Cast(Weekday(DateParse([Measures].[Issue created date])) as NUMERIC)
WHEN 1 THEN "Sunday"
WHEN 2 THEN "Monday"
WHEN 3 THEN "Tuesday"
WHEN 4 THEN "Wednesday"
WHEN 5 THEN "Thursday"
WHEN 6 THEN "Friday"
WHEN 7 THEN "Saturday"
END

Or, you can use another “hidden” MDX function - WeekdayName() to achieve an even shorter code:

WeekdayName(Weekday(DateParse([Measures].[Issue created date])),0,0)

You can change the last integer to adjust the offset of the day names.

These “hidden” functions can be found on the Pentaho Mondrian documentation page, but the description of them can be really limited: Pentaho Mondrian Documentation

Edit: Additionally, instead of using DateParse to convert the string format date -

DateParse([Measures].[Issue created date])

you can use the .GetDate function to retrieve the Date value:

[Issue].CurrentHierarchyMember.GetDate('Created at')

Cheers!
Nauris / eazyBI support

1 Like