Product: TIBCO Spotfire®
How to show the first day of each week on the x-axis of a chart?
Environment: Product: TIBCO Spotfire (desktop client / Analyst / Professional)
Version: All supported versions
OS: All Supported Operating Systems
--------------------
Product: TIBCO Spotfire Web Player (incl. Consumer and Business Author)
Version: All supported versions
OS: All Supported Operating Systems
Description: In normal use, the Week() function returns the week for a date as an integer between 1 and 54, where the selection of the days identified to be in the first week of the year depends upon regional settings. Using the result from this function on the x-axis of a chart can make it hard to understand which days are included in each of a year's numbered weeks. How to show the associated Monday of each week?
Resolution: In the example below, use the function “DayOfWeek” to find which day it is, then add or subtract the days to find the Monday. Then use the new column for the x-axis.
case DayOfWeek([Mfg Date]) when 0 then DateAdd("dd",1,[Mfg Date])
when 1 then [Mfg Date]
when 2 then DateAdd("dd",-1,[Mfg Date])
when 3 then DateAdd("dd",-2,[Mfg Date])
when 4 then DateAdd("dd",-3,[Mfg Date])
when 5 then DateAdd("dd",-4,[Mfg Date])
else DateAdd("dd",-5,[Mfg Date]) end
Keywords: first day, first day of week, Monday, x-axis, chart, plot, visualization, calculated column, Week, DayOfWeek, DateAdd, case
Comments
0 comments
Article is closed for comments.