I have the following code:
ggplot(mushroom,aes(x=date,y=value)) +
geom_point(aes(fill=type),shape=21,size=3)+
geom_line(aes(color=type))+
theme_bw()+
theme(axis.title.x=element_blank())
This is giving me something like this:
What I want is something like this:
Note, the x-axis labels. I want mine also to start from Nov 01.
Use this
+ scale_x_continuous(breaks = c('start_date', 'end_date'))
I don't know in what format you have date column:
start_date would be Nov 01 and end_date Nov 22
Related
I have issue converting parameter string to date.
I have list of data as:
Jul 28 2017 Call
Jan 8 2018 SMS
Apr 24 2018 Call
Jul 2 2018 E-Mail
Jul 13 2018 Call
Oct 1 2018 Call
Nov 27 2018 E-Mail
Dec 31 2018 Call
Jan 1 2019 SMS
Apr 1 2019 SMS
Jun 4 2019 SMS
I want them to be presented as eg. 06/04/2019 if possible
I tried LSet(Format(Parameters!DateInfo.Label,"MM/dd/yyyy"),12) in expression, but when I run the report it is showing me just like this MM/dd/YYYY.
For your parameter, you probably should be using a dataset for the dates with the Value set to use a date field and the Label using the string representation of the date (CONVERT(CHAR(10), THEDATE, 110) AS DATE_LABEL).
I'm guessing the user isn't typing the parameter values in which means that there's already a dataset for the dates. Add another column to the dataset with the date as a date field to use as the Value while using the text as the Label.
If you cannot fix that and still need to convert the text field into a date, you could use the CDATE function which will convert text into a date field.
=Format(CDATE(LEFT(Parameters!DateInfo.Label, 12)),"MM/dd/yyyy")
Is it possible to display or return a different value for an attribute in SSAS?
For example, in my date dimension I derive the business day within the month. Something like this:
DateId Date BusinessDay WeekDay
20120101 2012-01-01 01 Mon
20120102 2012-01-02 02 Tue
20120103 2012-01-03 03 Wed
20120104 2012-01-04 04 Thu
20120105 2012-01-05 05 Fri
20120106 2012-01-06 05 Sat
20120107 2012-01-07 05 Sun
02120108 2012-01-08 06 Mon
But the problem is every month has a 01 BusinessDay in it, so when I am creating a hierarchy for this, I get an error for duplicates. Also on the weekends I keep the business day constant.
So I need a way to have a unique BusinessDay value, but show a user friendly value. I was thinking I could concatenate the DateId + BusinessDay, but with an expression only show the Right 2 characters.
Making 2012010101 display as 01
Is this even possible? Maybe in the attributes properties somewhere?
I was able to accomplish this by doing the following:
I added two columns to the DSV. One for the value to be displayed, and a second for the true value. Next, I opened the Design view of the date dimension and added the attribute relationship just like adding any new attribute.
Now to make this work you have to open the attribute properties. and scroll all the way to the bottom and under the Source options update the KeyColumns to the actual value attribute. Next, in the same Source Options, update the NameColumn to the Display value you want.
It's actually pretty easy.
I'm trying to retrieve the previous year's end value of a measure.
I know this code gets the value of the previous year, but at the same point in time during that year (so Mar 2012 looks to Mar 2011).
([Measures].[MeasureName], ParallelPeriod([Time].[Calendar].[Year]))
I'd like any date in 2012 to look at the last value in 2011 (Dec 2011). So if we're looking at the Year level of 2012 or any Month level, it all points to Dec 2011.
where are you trying to do this? On a MDX query? Or on a KPI?
Like you can access the value of Dec 2011 like this for example:
ParallelPeriod([Time].[Calendar].[Year], 1, [Time].[Calendar].[Year].[December 2012])
Combine the time functions:
ClosingPeriod([Time].[Calendar].[Month], Ancestor(ParallelPeriod([Time].[Calendar].[Year], 1), [Time].[Calendar].[Year]) )
I am trying to sort a list of records that have been created using a screen scraping script. The script adds the following style of date and time (timestamp) to each record:
13 Jan 14:49
The script runs every 15 minutes, but if I set the sort order to 'time DESC' it doesn't really make sense because it lists the records as follows:
13 Jan 14:49
13 Jan 12:32
13 Jan 09:45
08 Feb 01:10
07 Feb 23:31
07 Feb 06:53
06 Feb 23:15
As you can see, it's listing the first figure correctly (the day of the month in number form) but it's putting February after January. To add to the confusion it's putting the latest date in February at the top of the February section.
Is there a better way of sorting these so they are in a more understandable order?
If you are storing the values in a database, simply use the column type datetime when creating the field. The database will treat the field as time and will sort the values chronologically.
Otherwise, if you are storing the values elsewhere, for example in a flat file, convert the formatted time to unix time. Unix time is an integer, thus you can sort it easier.
Time.parse("13 Jan 09:45").to_i
# => 1326444300
Time.parse("08 Feb 01:10").to_i
# => 1328659800
You can always convert a unix time to a Time instance.
Time.at(1328659800).to_s
# => "2012-02-08 01:10:00 +0100"
Have a column of dates which i need to compare to a specific time of the year, which establishes what calculation needs to be applyed then depending on the outcome apply conditional formating to highlight an adjcent cell, but need to remove the YY element as the contents spans multiple years.
if the date in A1 is between 1st Jan & 14th Mar use -8
if the date in A1 is between 15th Mar & 15th Oct use -17
if the date in A1 is between 16th Oct & 31st Dec use -8
Then deduct the above value from B1 to give a target
for each row (from 3 onwards)
if the target is < the value in n then change background orange in f
and repeat.
Any help would be greatly welcome, thank you.
Is this Excel? If so, then it has all kinds of conditional formatting stuff built right into the application; no programming needed.