I am trying to shift the start date of the transactional (don't know if thats a word) week from sunday (index 0) to friday (index 6). This is the only view in any of our data models that would use this transnational week. I am creating a 2 new dimensions in the specific view this report is generated from. It is for a week over week report so there would have to be a transaction week associated with it, but even though the week would start friday, the transaction week would have to be read as the next week. (example start Friday 10/25, but transaction week is still read as 10/28).
I have tried to create two new dimensions and even had multiple extensive conversations with looker support and we couldn't come to a feasible solution.
[![dimension: friday_start {
type: number
sql: case when ${transaction_datetime_day_of_week} = 'Friday' then 1
when ${transaction_datetime_day_of_week} = 'Saturday' then 2
when ${transaction_datetime_day_of_week} = 'Sunday' then 3
when ${transaction_datetime_day_of_week} = 'Monday' then 4
when ${transaction_datetime_day_of_week} = 'Tuesday' then 5
when ${transaction_datetime_day_of_week} = 'Wednesday' then 6
when ${transaction_datetime_day_of_week} = 'Thursday' then 7
else null end;;
}
dimension: friday_week_start {
sql: ${transaction_datetime_raw};;
type: date_day_of_week
order_by_field: friday_start
convert_tz: no
}][1]][1]
The dimension works, but it aggregates the total sum of transactions for friday-thursdays, which could be useful in future predictions and modeling, but that's not the point.
Your report comes from an explore, and that explore is in a model. Each model can have its own week_start_day property (https://docs.looker.com/reference/model-params/week_start_day). If more than one query from this explore should treat the start day of the week as Friday, then this would be my approach.
Create a new model
Add this property to it... week_start_day: friday
Find the explore which is behind the report by clicking the "explore from here" button and then click the Looker logo in the area just above the field picker to be taken to the LookML which defines that explore
Copy or Cut the explore from that location and paste it in your new model
Modify any existing saved reports by using the "Find and Replace in all content" button in the Content Validator if you fully moved the explore, or find only the desired content to be moved and do the smaller replace on them one by one. If you need to move a lot, but not all, there are tricks on how to fool the content validator into helping you do that.
~A Looker
Related
Wasn't sure how to summarize the problem in the title, but I will try to at least be clear.
I had made a database for a friend several years ago to run his car rental business in a way that was better than Excel. It has been running quite smooth, however, it looks like there is a simple yet not-easy modification needed.
I have a form called ReservationDetails (Subform of main form called ClientDetails), from which cars are booked, with the 3 most important fields being: VehicleID, PickUpDate, and DropOffDate. When making a new booking, that is, when selecting a car in ReservationDetails and picking a certain Start Date, it is important to check whether the car is already booked for the given date. The way I had done this was by running a hidden query as subform that shows the latest date of the car's booking (linked by VehicleID), looked up StartDate and EndDate in two fields called DateFake1 and DateFake2 and ran this in the After Update of the StartDate field of the form:
If Me.PickUpTimeDate >= Me.DataFake1 And Me.PickUpTimeDate <= Me.DataFake2 Then
MsgBox "This car is booked on this date! Choose another date.", vbOKOnly, "Car cannot be booked"
Me.PickUpTimeDate = ""
Me.PickUpTimeDate.SetFocus
Exit Sub
Else
End if
This seemed to work fine. But, only if there was only one booking later than current dates. That is, if let's say the car is booked for 3 days next week, then also next month, then also for christmas, all of them being start and end dates that are in the future, what is checked is only the last start and end date.
I am stuck. I have no ideas how to resolve this! Can anyone point me in the right direction, please?
Respect,
Murlan
I have tried to mess with Between PickUpDate and DropOffDate, but I am just out of ideas for the moment.
I don't understand the logic of Power Query Editor.
I have a big table with data from 2019 to 2024 (one column contains the monthly information).
I want to filter the data by the date of that column, but it has to be dynamic.
Two options:
The data I want to consider is "Current month -2". So all historical data minus current month.
The data I want to consider is a parameter extracted from somewhere (e.g. I set the latest month to consider manually somewhere in an Excel, which usually is "current month -1" but not always (best).
I would be happy with any of the two solutions.
Currently I found somewhere this formula which filters out vs last month:
= Table.SelectRows(#"Changed Type",each [Month]< Date.From(Date.StartOfMonth(DateTime.LocalNow())))
But somehow I do not find the way to go 2 months back.
Thanks a lot!
BR
I'm pretty new in Tableau. I have looked at the forum already and the answered suggested. But I'm not quite sure it match my question.
I have a bunch of records. This is about registration for a sport lesson depending on time. All of them have a start date and and some of them a finish date. The other never finish (They continue until date T with T = now).
My goal is to compare only the first 6 months of all my records, I think there are 50 of them, like the evolution during this period of time. So, for some the start date would be in January 2009, for some other, it would be in May 2016, etc.
As field provided, I have the start date and the number of person that have subscribed those lesson through time.
So, do you if there is any to achieve this goal? Is there enough detail for you to understand what I am saying ?
Thx to you guys !!
EDIT
You can find enclosed a screenshot of the result that I already have.
number of registration for all lesson through time
I'm not sure to be clear, what I try to do is to compare the first 6 months only of each courses. So the evolution of the first 6 months of this course compare to the evolution of the first 6 months of this other course and so on :)
If I understand your question correctly you are wanting to show only the first six months of your data but you want this by each category.
I am assumuming that by definition this means 6 months from the first record in your data for each category.
In order to achieve this I would create a true/false flag using a level of detail expression. As you are new to tableau I would suggest you do some reading on this but basically you can force a calculation to be at a certain level of the data rather than at the row level. You use this to find the minimum date in the table and then use a date diff to return true if the actual date field is within 6 months of this.
Create a calculated field as follows:
[date] <= DATEADD('month', 6, { FIXED [category] :min([date])})
Then drag this onto your filters pane and select "TRUE". This should give you only the first six months of records for each category.
Let me know if you need anything else.
So, pretend I'm looking at sales of an item vs time. One item I started selling 3 years ago and one is from only a year ago.
I want to look at how the performance of both items change starting from first date sold as "day 0" not from first date sold as say "march 2016".
My date field is a calendar date and I'm not sure the best way line everything up from within tableau that will allow me to display the result on a single graph. I'd also like an option that will scale to 10+ items
Any approaches would be great!
Create a calculated field called first_Sale_date_per_item defined as {fixed Item : min(sale_date)}
Then you can define days_since_first_sale as datediff('day', first_sale_date_per_item, sale_date)
Could someone please explain me creating BINS based on Weekdays in Tableau? I tried creating different Calculation Fields but it won't work
You're working too hard.
Tableau already knows how to bin values by dates at many levels of granualarity: such as year, month, day, weekday, hour etc. So you don't need to create a new field to bin dates by the day of the week. (creating bins is not difficult, it's just already available in this case)
Just put a discrete (blue) date or datetime field on a shelf. You'll see the date level of granularity displayed like, say, YEAR(MyDateField) with a leading plus sign.
You can either
click on the plus sign to drill down by adding a second level, say MONTH(MyDateField)
or
right click on the field to select the date level of granularity you want
Alex's Answer is exactly correct, Tableau will perform the operation automatically. What is great about is that you can select various formats (Full day name, number, 1 letter or 3 letter day etc.).
However if you absolutely need to you can used this formula:
datepart('weekday',[Date])
to give you the 1 (Sunday) to 7 (Saturday) value if you need it for something other reason, say another calculation.