Altering x-axis for dates in Tableau - tableau-api

I have a data set that has dates for many years. I can easily filter the data by month or week, but I was hoping to change the X axis to make it start in October and end in April.
Is there a way to do this in Tableau without altering the original data and listed dates?

I don't know about it ending in April since that would not be a full 12 months but you can make it start in October. Right click on your date field > Default Properties > Fiscal Year Start. Then select October.

Related

Tableau Fixed Max date registered by month

I want to create a graph line in tableau with a count distinct id per month.
I use an excel spreadsheet that is updated a few times per month but never on the same date, so I have different dates registered as months go by.
I want to use the last date registered per month so I can use that date to show month's trend through the years. Each id represent a different construction building, so it is expected that the same id can be found on different months.
This is what I tried: Tableau Fixed (LOD) formula the get last date registered per each month:
{ FIXED [id_constructionbuilding], MONTH([date_registered]): MAX([date_registered])}
Then I use rows and columns in tableau but I get more than one max date (my excel has 2020 and 2021 dates, so it's picking dates from October 2020 and October 2021 for example). Dates are order according to Spanish so you will see month and days shifted:
I would suggest updating your calculated field to:
{ FIXED [id_constructionbuilding],DATETRUNC('month', [date_registered]), DATETRUNC('year', [date_registered]):MAX([date_registered])}
This will keep the level of detail (LOD) to the id_constru..., month and year.

How to display date from a specific month in Excel Pivot Chart

I want my chart showing period from FEB-2020 to DEC-2021. However, if i filter away January, it will remove January for 2020 & 2021. This is because, "Years" & "Date" They are independent filters. How to only filter away JAN-2020 only?
I have figured out.
If create using pivot chart, we can either show month with no data or show month only data. However, show month with no data, u will show full year-month for 2020 which is unwanted.
For pivot chart, u have only 1 way to control month to display is to create dummy data for that month. Then, run a macro to delete "(blank)" legend.
Hit me up, if anyone interested to know more.☺

How do we calculate difference and percent difference between two columns in tableau

]Difference and percent Difference must be calculated.
I cannot do Apr20-MAy20 because it is not always the same. I need to show the current month and previous month
So I did a relative filter to just show the current month and previous month.
So the difference of two columns should automatically change when the month changes.
Now how do I get the same month of prior year, how do I filter ?
I also need to calculate the difference of current year same month and previous year same month.
Thank you in advance for any help!
When I do table across difference, the difference value is overwriting the existing May and Apr month values as the below screen shot, how to show the difference in another column
Currently:
Below is Expected:
Sounds like you should create a custom filter for the dates. You want:
This month this year
This month last year
Last month this year
There are a number of ways you could do this. I'll give one example and will assume there aren't any future dates in your data set.
[DateFilter]: DATETRUNC('month',[YourDateField])>=DATETRUNC('month',DATEADD('month',-1,TODAY())) OR DATETRUNC('month',[YourDateField])=DATETRUNC('month',DATEADD('year',-1,TODAY()))
Put the to the filters shelf, set to True, and it should keep the months you want.
Then you can just use the standard table calculations to calculate Difference and Percent Difference.
Note, the formula isn't tested, just typed directly into here, let me know if it doesn't work
Based on your comments look at creating separate calculations for to YoY / MoM / etc calculation. That also means creating calculated fields to isolate the Current Month, Previous Month, etc.
For example, the current month:
[isCM]: DATETRUNC('month',[YourDateField]) = DATETRUNC('month',TODAY())
The previous month:
[isPM]: DATETRUNC('month',[YourDateField]) = DATETRUNC('month',DATEADD('month',-1,TODAY()))
Then month on month, something like:
[MoM]: (SUM([Measure])*INT([isCM]))/(SUM([Measure])*INT([isPM]))
To make your table check this article about using the placeholder technique to create tables in Tableau

Tableau: time series chart displaying last day of month instead of first

In any time series chart, it looks like Tableau defaults to the first day of the month on the tick marks.
Is there a way for Tableau to show the last day of the month instead?
You can sort of force it by going into "Edit Axis", starting it on a month end, and 1 as the monthly interval. However, this is not a dynamic process and would require that I update this every time I had new data.
Anyone have any ideas? Thank you!
If in your data series you want each data point to represent the whole month, and you just want to label it with the last date of that month, then this workaround might work:
use calculated field to coerce all dates in the month to the last date of that month: DATEADD('day',-1,DATEADD('month',1,DATETRUNC('month',[Order Date])))
use this field as date in your time series
use 'More -> Custom -> Month / Day /Year' as display option for this field

Crystal report formula syntax

I have a report I am trying to modify in Crystal. It has a data field that has a formula in it, but I want to use another formula.
This is an example of what I am trying to do.
[((# Days in January) – 15) x (Market Rent/(# Days in January))]
+ [((# Days in February) – 0) x (Market Rent/(# Days in February))]
+ [14 x (Market Rent/(# Days in March))]
I have ADO commands built out for the market rent, and a start date and end date. The months in my example are just that an example. I am not sure how to take my ADO command dates that are entered in on a filter page, and put them in a formula like the one above. Any ideas?
Also, in the first and last para. the -15 and the 14 are for a date in the middle of the month. So if the start date was on the 15th of Jan, and the End date was the 15th of march. This formula would calculate my loss of rent during vacancy.
If I'm reading your question correctly, you want to take a date field and find out how to measure the number of days in that month, the month before it, and the month after it. Here's some Crystal formulas to help you out. Let's assume your date field is called {#DateFld}:
To find the number of days in a particular month relative to a particular date, try this:
local datevar X:=cdate(dateadd("m",0,{#DateFld}));
datediff(
"d",
date(year(X),month(X),1),
date(year(X),month(X)+1,1)
)
I recommend you copy & paste this in 3 different formulas:
- In the 1st formula, replace the "0" with a -1 to get the number of days in the previous month.
- In the 2nd formula, don't change anything. That'll get you the number of days in the current month (i.e. the month that {#DateFld} is in)
- In the 3rd formula, replace the "0" with a +1 to get the number of days in the next month.
For example, if {#DateFld} is March 10th, 2011, the 1st formula will give you 28, the 2nd will give you 31, and the 3rd will give you 30.