Tableau: Average sales for weekdays - average

I'm fairly new to Tableau and got stuck at a problem for a while now.
In my dataset are salesdata down to the day of payment.
Basically it looks like this:
Date: Revenue:
2015-01-01 45,45
2015-01-02 20,05
2015-01-03 05,55
2015-01-04 57,33
... ...
What I am trying to establish is a line chart that shows a week from Monday to Sunday (column) and tells me how much revenue there was on an average Monday, Tuesday, and so on. It would take into account the 52 Mondays of 2015 and display the average revenue for Mondays.
Every suggestion is much appreciated!
Cheers, Markus

Create a calc field on your Date for weekday:
datename('weekday',[Date])
Place this on the Columns shelf. Place Revenue on the Rows shelf and change the aggregation to AVG.
You can change the Start of week to default to Mondays by the following:

Thanks for your answer, Bernando.
I've tried this already but the numbers do not seem to match. The total amount of revenues generated on a Monday is 67.677 and the average value is calculated to be 120,94. I was expecting something like 67.677/52 weeks = 1.301,48. Any chance to get it like this?

Related

How to calculate the last week of every month?

I've been having a look around but I can't seem to find anything that answers this question. I want to calculate the date for the last week of every month. For example, the date for the last week of April 2021 is 26-04-2021. I want a date, not a week number.
I use Google Big Query, I do have a calendar table I could use to extract year and month.
Thanks,
Emily
Try date_trunc:
SELECT date_trunc(last_day(month1st, month), week(monday))
from unnest(GENERATE_DATE_ARRAY('2021-01-01', '2021-12-01', interval 1 month)) AS month1st;

Tableau Fiscal Date Calculation

How can I get this outcome in Tableau?
I am trying to compare This Fiscal Year Vs Last Fiscal Year Revenue Data.
I need a calculation that will be able to add an extra day for order_date dimension.
Please help!
dateadd('day',1,[order date])
Check out this link for more date calculations.
https://help.tableau.com/current/pro/desktop/en-us/functions_functions_date.htm

mdx query to calculate difference between measure at nearest quarter date and measure today

I am trying to calculate a measure which is the difference between a measure (say, profit) today and the nearest preceding quarter.
E.g.: if the quarter months are March, June, September and December, then:
If the current month is May, then the calculated measure = Profit(May)-Profit(March)
If the current month is November, then the calculated measure = Profit(November)-Profit(September)
If the current month is December, then the calculated measure = Profit(December)-Profit(September)
I'm new to MDX and would really like some help on this.
I'm aware of .CurrentMember.PrevMember to get the previous member, but that doesn't help if you don't know how many previous members calls you should use.
Welcome to MDX. To solve the problem you need to have basic understanding of "User Hierarchy".Plus you should know how the functions "currentmember", "parent", "lag()" and "lastchild".
Based on this follow the example below. I am trying to re-produce your example on AdventureWorks for year 2013.
Lets first see all the internet sales amount for 2013
select
{[Measures].[Internet Sales Amount]}
on columns,
{
[Date].[Month of Year].[Month of Year]
}
on rows from
[adventure works]
where
[Date].[Calendar Year].&[2013]
Result
Now lets make a measure that will result value for the last month of previous quater
with
member [Measures].[LastMonthOfPreviousQuater] as
([Date].[Calendar].currentmember.parent.lag(1).lastchild,
[Measures].[Internet Sales Amount])
select
{[Measures].[Internet Sales Amount],[Measures].[LastMonthOfPreviousQuater]}
on columns,
{
[Date].[Calendar].[Month].&[2013]&[09]
}
on rows from
[adventure works]
Result

Tableau, Week to Date, Month To Date, Year to Date parameter

I have a data set spanning 2 years and is updated daily, created a dashboard to give a view of incidents by date group. I have created a parameter using date trunc for Day/Week/Month/Quarter/Year. This is in Tableau.
I am trying to get the parameter to show a Week to date, Month to date and so on view. IE if on Weds 15th Dec I selected the weekly view, it would only show data for every week in the data set for Sat-Weds (My weeks go Sat-Fri) or the monthly view every month between 1st-15th
Ideally I am wanting this as a simple parameter for a drop down menu, I can do the week to date stuff as a rolling sum restarting every week in a separate table, but for ease I just need a date group function that will allow to do this.
Any suggestions would be appreciated.
Cheers
Pete
The solution is 5 parts:
Date Part Parameter
Max date [Max Date]
Dynamic date part of the Max date [Dynamic Date Part Max]
Dynamic date part of the historical dates [Dynamic Date Part]
Filter those date parts <= the Max date [Dynamic Date - Lass than Max]
Date Part Parameter
Max Date
This is the calculation you'd use with your dataset to find the max date.
{ MAX([Order Date]) }
In order to create a good example, I'm going to set my Max date to a specific date the falls in the middle of a week, in the middle of a month and middle of the year. I'm going use June 13th, 2018 as my Max Date.
So, if you want to follow along you can use the below date as your max date. You can also use this data set if you'd like.
DATE(#2018-06-13#)
Dynamic date part of the Max date
DATEPART([Select Date Part], [Max Date])
Dynamic date part of the Historical dates
DATEPART([Select Date Part], [Order Date])
Filter on Historical dates parts <= the Max Date
[Dynamic Date Part] <= [Dynamic Date Part Max]
Now that we have all the pieces we need let's check to make sure they are working as we would expect.
Looks like we're seeing all the days of the month that are <= the 13th.
When we change it to Day of the Week we see only the days of the week <= the 4th day of the week which is Wednesday when the week starts on Saturday.
Now let's calculate the running sum of sales along our dynamic date part to better help you with your example.
Drag the measure you want to calculate the running sum onto the label, then create a quick table calculation. We'll next need to edit this table calculation as so.
You'll then see your calculation working as you would expect.
Hope this was helpful. Happy vizzing!

Difference between today and 7 days ago

I spent some hours googling now but I can't find a solution that fits, so you guys are my last hope.
I have sales data that is not aggregated (every single item sold listed seperately). I aggregate them in Tableau by Date so I can see on what day we sold which amount if items. What I'm trying to do now is compare the value of today (Saturday) with the value of last Saturday. My problem is that I dont know how to aggregate the sales of 7 days ago and today in the same table so I can compare them.
Is there a proper way in tableau to do this? Really grateful for every answer.
Create a calculation as below:
IF [Order Date]= TODAY() THEN 'Today'
ELSEIF [Order Date]=DATEADD('day',-7,TODAY()) THEN '7 Days Ago' END
Now build the view and filter out nulls from label field.