How to create a metric based on the data from the previous date? - gooddata

I'm trying to create insight in that way, that it is always based on the previous day's data. How can I create a metric in that way that the user's choice of the data range in the dashboard wouldn't have any influence on the visualization? Thanks for help

You can write your metrics to select the previous day’s data and then ignore the parent filters coming from the report or dashboard with WITHOUT PF statement. You can achieve it by MAQL below:
SELECT COUNT Event WHERE <date_attribute> = THIS - 1 WITHOUT PF

Related

Getting rid of date filter on BigQuery?

I'm trying to get rid of this particular date filter on BQ and have a date column instead (kindly check the red circle to see what I'm talking about)
This data was extracted from Microsoft (Bing) Ads using Supermetrics. Any idea how to tackle this? Let me know if you need more information. Thank you.
AK
So the string depicted in the red circle is part of the table name i.e. 2021111.
So to view all the data you will want to create a query that looks at all the tables like, but be careful as datasets can get BIG fast.
SELECT *
FROM `BINGADS_AGE_GENDER_*`
If you wanted to only combine a certain date range you could use
SELECT *
FROM `BINGADS_AGE_GENDER_*`
WHERE _table_suffix BETWEEN '20211001' and '20211101'
If you use this datasource within datastudio you can use the #DS_START_DATE and #DS_END_DATE parameters with the date picker.

Is there another way in Qlik Sense to show the latest weeks data by default as well as a filter to change the week you're looking at?

I am looking to add a weekly filter onto my Qlik dashboard to allow me to change the weekly data that is displayed on my dashboard. My original idea works well as I wanted to display the latest weeks data and compare this to the previous weeks and this gives me exactly what I want.
To enhance this and give the dashboard a bit more flexibility and just in case someone wanted to look at a different week, I thought it might be a good idea to add a weekly filter but the way I have built the dashboard won't allow me to do this. The following is an example of what I have:
In my database table I have a rank column (latest_week_rank) where the latest weekending (i.e. Mon 13th to Sun 19th Jan) has a value of 1 and the 2nd latest week would be 2 etc. I have then written the following code in my data tab:
latest_week = 1;
previous_week = 2;
I have then written the following which is then called within a Multi KPI:
vOrdersWTD =Sum({<latest_week_rank = {$(latest_week)}>} total_orders)
This is obviously where the problem lies as having the weekly filter makes no difference as no other weeks show up but I am not sure how I change my code in order to make this all work.
I would really appreciate if somebody could advise on how I can change this around.
Instead of assigning your predetermined variable in set analysis, use the actual field. Something like:
$(=
'Sum({<latest_week_rank = {'
& max(latest_week_rank)+1
& '}>} total_orders'
)

Qlikview - Target missing where no actual value

I have a fact table of Delay by Date by Category (and many other Fields). I have another (target) table of DelayTarget by Month and Category.
I am currently associating the target table to the fact table on Month & Category but when there is no Delay for a given Category in a given Month, then the DelayTarget value does not display in my dashboard.
How do I associate the DelayTarget to all Months in my main dataset - even when there is no Delay to report? I think I want to create a Zero value for Delay when it is null but I don't know how to do this or if this is the best method.
You need to create MasterCalendar to fill gap in dates.
I can give you more detailed answer but the best would be to share you data model (ctrl +T) and some example data from tables (or even better just.qvw)

Power Bi creating monthly measure from repeated monhts

I have an application database that is designed the following way: (I cannot change it)
I need to be able to create a cash flow that can tell me by month, Property and type what the amount of that month is. I figured I need in a measure in a table that has all the months I need, but I am not sure how to do it.
Any help would be greatly appreciated it!
Link to screenshot, it wont let me post it directly
Even with the screenshot, it is not entirely clear to me what is meant by repeated month. I am assuming that if repeat_count = 2 and amount = 100 then amount_wanted = 200.
I am also assuming that you already loaded the data into Power BI.
In that case you need to perform the following steps:
Create a calculated column holding the month. You can do so using the function month(date).
Create a calculated column as
amount_wanted = [repeat_count] * [amount]
Create a new measure:
new_measure = sum([amount_wanted])
Create a matrix visual with property and type in the rows, month in the columns and new_measure in the values.

Bigquery and Tableau

I attached Tableau with Bigquery and was working on the Dash boards. Issue hear is Bigquery charges on the data a query picks everytime.
My table is 200GB data. When some one queries the dash board on Tableau, it runs on total query. Using any filters on the dashboard it runs again on the total table.
on 200GB data, if someone does 5 filters on different analysis, bigquery is calculating 200*5 = 1 TB (nearly). For one day on testing the analysis we were charged on a 30TB analysis. But table behind is 200GB only. Is there anyway I can restrict Tableau running on total data on Bigquery everytime there is any changes?
The extract in Tableau is indeed one valid strategy. But only when you are using a custom query. If you directly access the table it won't work as that will download 200Gb to your machine.
Other options to limit the amount of data are:
Not calling any columns that you don't need. Do this by hiding unused fields in Tableau. It will not include those fields in the query it sends to BigQuery. Otherwise it's a SELECT * and then you pay for the full 200Gb even if you don't use those fields.
Another option that we use a lot is partitioning our tables. For instance, a partition per day of data if you have a date field. Using TABLE_DATE_RANGE and TABLE_QUERY functions you can then smartly limit the amount of partitions and hence rows that Tableau will query. I usually hide the complexity of these table wildcard functions away in a view. And then I use the view in Tableau. Another option is to use a parameter in Tableau to control the TABLE_DATE_RANGE.
1) Right now I learning BQ + Tableau too. And I found that using "Extract" is must for BQ in Tableau. With this option you can also save time building dashboard. So my current pipeline is "Build query > Add it to Tableau > Make dashboard > Upload Dashboard to Tableau Online > Schedule update for Extract
2) You can send Custom Quota Request to Google and set up limits per project/per user.
3) If each of your query touching 200GB each time, consider to optimize these queries (Don't use SELECT *, use only dates you need, etc)
The best approach I found was to partition the table in BQ based on a date (day) field which has no timestamp. BQ allows you to partition a table by a day level field. The important thing here is that even though the field is day/date with no timestamp it should be a TIMESTAMP datatype in the BQ table. i.e. you will end up with a column in BQ with data looking like this:
2018-01-01 00:00:00.000 UTC
The reasons the field needs to be a TIMESTAMP datatype (even though there is no time in the data) is because when you create a viz in Tableau it will generate SQL to run against BQ and for the partitioned field to be utilised by the Tableau generated SQL it needs to be a TIMESTAMP datatype.
In Tableau, you should always filter on your partitioned field and BQ will only scan the rows within the ranges of the filter.
I tried partitioning on a DATE datatype and looked up the logs in GCP and saw that the entire table was being scanned. Changing to TIMESTAMP fixed this.
The thing about tableau and Big Query is that tableau calculates the filter values using your query ( live query ). What I have seen in my project logging is, it creates filters from your own query.
select 'Custom SQL Query'.filtered_column from ( your_actual_datasource_query ) as 'Custom SQL Query' group by 'Custom SQL Query'.filtered_column
Instead, try to create the tableau data source with incremental extracts and also try to have your query date partitioned ( Big Query only supports date partitioning) so that you can limit the data use.