OBIEE - Change pivot table row values based on prompt - pivot-table

I currently have a set of 12 pivot tables that I display based on a prompt. So the user simply clicks on a 'View By:' dropdown and chooses which table to view. This was accomplished through simple 'dummy tables' and a presentation variable.
My question: Can I set up a similar prompt to change the row values in my pivot tables?
For example, my row values are currently annual (12, 24, 36, ...). I would like to give the user the option to view the data on a quarterly (3, 6, 9, ...) and monthly (1, 2, 3, ...) basis.
Can I add a second 'View By:' dropdown so the user can select both the table, and row values the table is displayed on?

I'm assuming you have a period dimension, with columns for year, quarter and month. If not, you may be able to use a variant of this.
If so, you can use the index col function. To set this up:
You would have a variable prompt, setting a presentation variable with the options [annual, quarterly, monthly]
In your answer, you would have one period column, changing the column formula to use the indexcol function. It would look something like:
INDEXCOL(CASE '#{myPresentationVariable}' WHEN 'annual' THEN 0 WHEN 'quarterly' THEN 1 WHEN 'monthly' THEN 2 END, period.year, period.quarter, period.month)

I was making this much more difficult than it needed to be. The solution is to create Groups for the different buckets of values I was referencing ((1,2,3,...), (3,6,9,...), (12,24,36,...)). Then simply set the corresponding column filter to Is Prompted and add the newly created Groups as Choices to your prompt's choice list.

Related

Identify elements that do not appear in the period (Google Data Studio)

I have a table that shows the recurrence of purchasing a product, with the columns: product_id, report_date, quantity.
I need to list in a table the products that are more than 50 days unsold. The opposite I managed to do (list those that were sold in the last 50 days) but the opposite logic has not yet been able to implement.
Does anyone have any tips?
An example of the table:
product_id,date,report_date,quantity
329,2019-01-02 08:19:17,2019-01-02 14:34:12,6
243,2019-01-03 09:19:17,2019-01-03 15:34:12,6
238,2019-02-02 08:19:17,2019-03-02 14:34:12,84
170,2019-04-02 08:19:17,2019-04-02 14:34:12,84
238,2019-04-02 08:19:17,2019-04-02 14:34:12,8
238,2019-04-02 08:19:17,2019-04-02 14:34:12,100
238,2019-08-02 08:19:17,2019-08-02 14:34:12,100
238,2019-10-02 08:19:17,2019-10-02 14:34:12,100
170,2020-01-02 08:19:17,2020-01-02 14:34:12,84
170,2020-01-02 08:19:17,2020-01-02 14:34:12,84
There are many steps to do this task. I assume the date column is the one to work with. Your example from table includes duplicated entries. Is it right that at the same time the order is there twice?
So here are the steps:
At first add an calculated field date_past to your dataset:
DATE_DIFF(CURRENT_DATE(),date)
To the dataset add a filter SO_demo with:
include date_past<30
Then blend the data with it self. Use product_id as Join key. Only the 2nd dataset has the SO_demo filter. Add to the dimension of this dataset the calculated field sold_last_30_days with the formula "yes".
In the table/chart to display add a filter on the field include sold_last_30_days is Null.

Splitting Multiple Ranges from a Single Range in Google Sheets

I am building a scheduling tool for my company. The structure of my Google Sheets document is a summary page with the entire schedule laid out for each employee in each department. Then, each employee gets their own sheet. In each employee sheets I have a section for Sunday, Monday, and Tuesday (the days each employee works). In each section by day I have a column indicating the hours they are on the clock, and then a column for each department. I have placed a checkbox into each cell and can activate the check box to indicate that this employee will be working in that department at that corresponding time. However, there are times when an employee is in a department more than once per day, meaning that the column with the checkboxes has, for example, checks in the cells corresponding to 7am-10am and 2pm-5pm, with unchecked boxes in the cells corresponding to 11am-1pm.
I have query functions that can pull the start and end times in that department if the employee is only in that department once per day. The output, after some concatenation, is something like "7AM-2PM".
=QUERY(A4:C17, "Select MIN(A) where (C=TRUE)")
=QUERY(A4:C17, "Select MAX(A) where (C=TRUE)")
However, I cannot think of a way to discriminate multiple start and end times. Using the above example, I'd like my output to be "7AM-10AM" and "2PM-5PM". These can be in separate cells or the same cell, doesn't make a difference to me. There can also be formulas in several cells if a subsequent formula needs to operate off a previous one.
I hope this makes sense in the way I have described it. I have been struggling for weeks trying to come up with something and am running out of time. Thanks for any and all help!
try:
=ARRAYFORMULA(IFNA(TEXTJOIN(CHAR(10), 1,
TEXT(FILTER($A4:$A17, IF((B4:B17=TRUE)*({FALSE; B4:B16}=FALSE), 1, )=1), "hh:mm\ - ")&
TEXT(FILTER($A4:$A17, IF((B4:B17=TRUE)*({B5:B17; FALSE}=FALSE), 1, )=1), "hh:mm"))))

How do you use ArrayFormula with arrays (after aggregation)?

In my example:
https://docs.google.com/spreadsheets/d/1QQNTw_r9-q-FqVNwUoYklup73niZCFyO0VDUYImP5fo/edit?usp=sharing
I'm using Google Forms as an eBay clone to sell rare items. Each bid is outputted from the form to the "Data" worksheet and then I have ArrayFormulas set up inside the "Processed" worksheet. The idea is that I want to process the bids so that we filter everything except the items with the highest bids. All data should be automatically updated, hence why I want to use ArrayFormulas.
My strategy is that in colum A, I first filter all unique items (=unique(filter(Data!A2:A,Data!A2:A<>""))) and end up with:
Jurassic Park 6-Pog Hologram Set
Princess the Bear TY Beanie Baby
Holographic 1st Ed Charizard
However, then in column B, we have to find the highest bid that corresponds to that unique item, e.g.:
=IF(ISBLANK(A2),,ArrayFormula(MAX(IF(Data!A2:A=A2,Data!B2:B))))
However, I don't want to have A2 be a single cell (A2) but an array (A2:A) so that it doesn't have to be manually copied down the rows. Similarly, I also want columns D and E to be automatic as well. Is there any way to achieve this?
Not sure if it would be considered easier than the previously posted answer, but in case this thread is found in the future, I think that this is a slightly simpler way to solve these kinds of problems:
Try this on a fresh tab in cell A1:
=FILTER(Data!A:D,COUNTIFS(Data!A:A,Data!A:A,Data!B:B,">"&Data!B:B)=0)
I did some research and found an answer very similar to what you were looking for. After rearranging the formula slightly to match your sheet, I was able to get this to work:
=ArrayFormula(vlookup(query({row(Data!A2:A),sort(Data!A2:C)},"select max(Col1) where Col2 <> '' group by Col2 label max(Col1)''",0),{row(Data!A2:A),sort(Data!A2:D)},{2,3,4,5},0))
This formula automatically populates product name, highest bid, username, and timestamp. I ran some tests, adding my own random names and values into the data sheet, and the formula worked great.
Reference: https://webapps.stackexchange.com/a/75637
use:
={A1:D1; SORTN(SORT(A2:D, 1, , 2, ), 9^9, 2, 1, )}
translated:
{A1:D1} - headers
SORT(A2:D, 1, , 2, ) - sort 1st column then 2nd column descending
9^9 - output all possible rows
2 - use 2nd mode of sortn which will group selected column
1 - selected column to be marged based on unique values

Getting minimum values out of calculated table

I have:
a table with user names
a table indicating actions with columns for user name, action time, action name. Named events unique_events
I started collecting data on January. I want to have a column in my table of user names which indicates how long it has been since a user first used my application and the first of January.
So if a user first logged in in January, the value of the row with that user's name will be 0. If one logged in on March it will be 2.
I tried:
Column = DATEDIFF(01-01-2016, MIN(SELECTCOLUMNS(FILTER('events unique_events','events unique_events'[User Name] = Users[User Name]),"DatedTime", [DatedTime])),MONTH)
which returns an error saying the Min function needs a column reference.
I also tried the same with FirstDate instead of MIN which returned an error saying FirstDate can't be used with summarize functions.
Any other ideas on how to achieve this, or fix what I tried?
(for simplicity, I will call your table 'Events', and user login dates field 'User_Login_Date').
First, define your app start date as a measure:
App_Start_Date:= DATE(2016, 1, 1)
Then, define measure that finds min differences between Application Start Date and User Login dates:
User_Start_Diff=: MINX(Events, DATEDIFF([App_Start_Date], Events[User_Login_Date], Month))
Drop this measure into a pivot table against user names, and you should have your desired result.
How it works:
1) MINX goes record by record and calculates date differences for each customer login. It then finds minimum in the results;
2) When you drop the measure into a pivot table, it splits MINX results by customer, and recalculates min for each of them separately. You don't need to do the grouping.
Creation of [Start_Date] measure is not technically necessary but a matter of good style - don't hardcode values in your formulas, always create measures. You will thank yourself later when you need to make a change.

Dataset from a Dataset in SSRS

I laid out the report, and I do a query that returns 30+ rows for a given period of time. One for each workflow. Now, I want to take that dataset (so the query only runs once) and define 6 datasets from it that filter it based on a single selected row. I will populate 8 boxes on the form for each of those datasets.
It appears that when you create a new dataset, it wants to go back to the datasource and ask you about all the data from that one again.
I was able to create a dataset that is a filtered view of the query and figured I could live with creating 6 datasets that ran the query each time filtering it differently each time. So, I need to do a 'copy' on the dataset and 'paste' it back in as a new dataset that is the same as the other one except with a new name.
I also need to set the default values for the Start/End date to be the 1st of last quarter, and the first day of this quarter. Is there a way to create calculated default values or do I need to do a query to return that?
if you are using table objects to create your report. you could use just 1 data set and add your filters to the table accordingly. just go to tablix properties>> filters tab.
for default values you can create expressions like for the first day of the current quarter:
=switch(DatePart(DateInterval.Quarter,today()) = 1, cstr(year(today))+"-01-01",
DatePart(DateInterval.Quarter,today()) = 2, cstr(year(today))+"-04-01",
DatePart(DateInterval.Quarter,today()) = 3, cstr(year(today))+"-07-01",
DatePart(DateInterval.Quarter,today()) = 4, cstr(year(today))+"-10-01")

Resources