Creating a 7 day live dashboard on Tableau - sql

As the title says I'm trying to create a live dashboard in Tableau that updates every day showing the data for the last 7 days. I'm querying through SQL and then importing it in Tableau. Do I have to specify this requirement in my query or would there be some way to do it in the tableau itself. Thank you so much. I would really appreciate the help.
Disclaimer: I'm pretty novice in tableau and SQL.

If you have a date field in your table then you can use it as a filter and select relative date as the option for the filter and in the dialog that appears you can enter number of days for the days field. Since you want the live data for the last 7 days, you can enter 7 and you'll get the updated data each time.

If you are querying through SQL, put the filter for date/ timestamp in where condition itself like so:
DATE(date_column_filter) >= (DATE(NOW()) - INTERVAL 7 DAY)

Related

SSRS data driven query?

I've got a question and it may sound dumb but am figuring it out as I go...
In SSRS there is an option to have a data driven query and in that you can edit the dataset to read parameters of the report who to send to ect., ect.,
Is there a way to have the query read an output of a subquery and if it doesn't equal the output it doesn't send but if it does, it does trigger the report sending?
In this particular example, the report needs to be triggered to send on the 3rd business day of the month. I have a query that reads the third business day written up but I am not sure how to get it into the query and read as if the date = 2023/01/04 then trigger report and send it off, otherwise do nothing, checking daily if it is that date.
In my business day query it has the columns, Date - which is the date, DayOfWeek - which is the numeral day of the week 2-6(for weekdays), Year, Month, Day, and Working day of the month(which is all 3s being the third business day.)
Should I have the query set to reading if workingdayofmonth = 3 then trigger the report? Would that be the easiest? I am not entirely sure how to code it as such into the SSRS data driven query.
Thank you for your time and help!
If you are using Enterprise edition, you can setup a data driven subscription.
I don't use Enterprise so I can't give a working exmaple but essentially, you create a dataset for the subscription that will only return data if your conditions are met.
As you previous question (linked here for other users reference) got you a calendar view that gives you the days the report needs to run, you can use that view, something like
SELECT * FROM myCalendarView WHERE TheDate = CAST(GetDate() AS Date)
The subscription will attempt to run everyday (or whatever the schedule is) but it will not produce anything unless the query above returns a resultset.
Take a look at this post which is similar to what you are attempting.
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/88b6c7ec-3cba-4b5f-b09d-c098dc933063/how-to-modify-an-ssrs-subscription-to-only-run-first-monday-of-every-fiscal-month?forum=sqlreportingservices

How to convert timestamp to days?

I have my MySQL database inserting timestamp when I upload a record, so what's entered is something like 2020-04-02 16:59:29. Is there a Vue.Js way to convert that into something like 10 Days Ago? If so, can anyone give the code for conversion in Vue.Js?
I hold the fetched DB records in an object called data_local as in my bellow code.
Last Activity : {{data_local.updated_at}} days ago
Use moment.js, you can get your desired data the way you want. First do install moment and then import & use.
Below are ways to get days:
Ex-1:( This will provide you No_of_Days days ago ( e.g- 10 days ago)
moment("2020-04-02 16:59:29").fromNow()
Ex-2: (If you want only 10 days without ago then use below)
moment("2020-04-02 16:59:29").fromNow(true)
For more information visit https://momentjs.com/

BigQuery: Why does Table Range Decorators return wrong result sometimes?

I've been using the Table Range Decorators feature daily since May in order to only query the data from the last 7 days in some of my tables.
Since 2 weeks, I've noticed that sometimes some data is missing when I use that feature. For example, if do a query to get the results for the last 7 days (by adding "#-604800000--1" to table), some data will be missing as opposed to if I query on the whole table (without a table decorator).
I wonder what could explain this and if there is a fix coming soon to address this?
If this can help the BigQuery team, I've noticed that when using Table Decorators some data was missing for us for October 16th between around 16:00 and 20:00 UTC time.
For the BigQuery team here are 2 jobs ids where some data is missing: job_-xtL4PlIYhNjQ5weMnssvqDmd6U , job_9ASNxqq_swjCd1eMmiQ6SmPpxlQ
and 1 job id where data is correct(without decorators): job_QbcRwYGbQv0BZdHreQEvRlYh-mM
This is a known issue with table decorators containing a time range. Due to a bug in BigQuery, it is possible for certain time ranges to omit data that should be included within the time range.
We're working on a fix and plan to have it released next week. After this fix is deployed time range decorators should again work as expected.

Building SSRS time series report from SQL datetime column

I need to create a SSRS report where the user specifies the start and end date (e.g. March 2012 to July 2012) and the result is a report with the following headings:
User Department Product Mar-12 Apr-12 May-12 Jun-12 Jul-12
The dates are stored in a datetime column (e.g.2012-06-11 14:48:04.787) in my SQL table which I'm using to build the time-series report.
Do I need to convert/transpose my SQL table first? Or should I be processing this in SSRS?
Your advice is much appreciated!
Based on your question it appears all your dates are in a single datetime column and your trying to display them, formatted as a month, in a single report with the report columns grouped and renamed based on the month. This is a pivot and I don't think you can do that within SSRS. The dataset will already need to be pivoted by the time SSRS gets it.
So, to me this sounds like something you'll have to do both pre and post SSRS. I did a similar report using days of the month. You can see the winning answer here. as opposed to months of the year.
Thinking through your logice, I think you'll probably have to build the query with the pivot and then send to SSRS. On the SSRS side you need 12 columns for all 12 months and then put some logic to hide the ones that don't get data. Your original pivot will need to be smart enough to pass the empty months so SSRS doesn't error out. The end result will appear the same but needs a lot of pre-thought and design effort up front.
You do the processing using SSRS - you would design it in the GUI editor(BIDS ) , and you can customize things using the VBasic code also(i.e, dates and logic)
Looks like you need an intro, I really recommend this video

Is there any way of searching just for a range of hours everyday for the last month?

I'm trying to create a search with Splunk that will allow me to have only the results during non working ours. I mean, Splunk to filter out from the logs all the events that occur from 8am to 5am.
Currently, the query I'm using is: earliest=-1mon so I get all the events from last month, but I only need those events that occurred outside working hours.
Is it possible?
There are probably multiple ways of doing this in Splunk. Below is one. I am extracting the hour field (24 hour format) into c_time and then limiting my results to ones that are between 8p and 5a. You can specify other filters like earliest and latest to be more specific. Hope this helps.
... | convert timeformat="%H" ctime(_time) AS c_time | search c_time>= 20 c_time<= 05
-Neeraj.