Google Spreadsheets multiple/scenario filter dropdown - filter

I can create drop down filter options for each of the dimensions in the spreadsheet: month, description, and type. using data validation and then sum(filter in Google Sheets. I want to include an option in the drop-down to include all months, include all types, etc. The end product would sum the amount based on the filters selected. I can sum(filter based on individual selections but my question is how to sum the amounts if one of the scenarios was: all months, groceries only, all descriptions.
https://docs.google.com/spreadsheet/ccc?key=0AgKUNhffHpmZdHZ3TGNXOUplN1R5UUlUSW5tVVp5b1E#gid=0

You'd have to use a Pivot Table. Then you have all this things in one view.
Select colums A to D. Go to Data/Pivot Table.
Add Month to Rows and Description to Colums (or vise versa) and add Amout to Values.
You'll see a total for all Descriptions/month and Grand total/month and /description.

Related

Google sheets Query, How to use query to select a value in rows based on header dates

I have sheet with two tabs and named a ranged where I'm trying to match and select a value in the budget tab based values from the month tab using query. The challenge I'm running into is how to use the dates in the header row of the budget tab in the Where of the query.
Find the value from named range Budget WHERE Category in Month tab matches Category in Budget AND date from Month tab matches date from budget tab, else value in Budget tab column lookup.
I think the sample sheets does a better job of showing this. Thanks in advance for any help.
https://docs.google.com/spreadsheets/d/1heN3I1tWiqBJ0LdHRK-26Koafk_8EudqfMy0cFWxFjI/edit?usp=sharing
I think in this case and the sheet layout it is better to use VLOOKUPs.
Just use this arrayformula across all months
=ARRAYFORMULA(if($H$16:$H="","",if(VLOOKUP($H$16:$H,budget,ifna(match(I$15,Budget!$E$1:$K$1,0),COLUMNS(budget)),false)="", VLOOKUP($H16:$H,budget,columns(budget),false), VLOOKUP($H$16:$H,budget,ifna(match(I$15,Budget!$E$1:$K$1,0),COLUMNS(budget)),false))))
Please note that I expanded the budget named range to cover the entire range, including Category and Lookup columns.

PowerBI groupby with filters

My company has tasked with slicing the information on turnover and to create different graphs.
My source data looks like this: Relevant columns are: Voluntary/Involuntary, Termination Reason, Country, Production, and TermDateKey
I am trying to get counts using different filters on the data. I managed to get the basic monthly total using the formula:
Term Month Count = GROUPBY('Turnover Source','Turnover Source'[TermDateKey],"Turnover Total Count", COUNTX(CURRENTGROUP(),'Turnover Source'[TermDateKey]))
This gave me a new sheet with the counts for each month.
Table that shows TermDateKey on Column 1, and Counts on column 2
I am trying to add onto this table by adding counts but using different filters.
For example, I am trying to add another column that gives me the monthly count but filtered for 'Turnover Source'[Voluntary/Involuntary]=="Voluntary". Then another column for 'Turnover Source'[Voluntary/Involuntary]=="Involuntary" and so on. I have not found anywhere that shows me how to do this and when I add in the FILTER function it says that GROUPBY(...) can only work on CURRENTGROUP().
Can some one point me to a resource that will give me the solution I need? I am at a loss, thank you all.
It looks like you may not be aware that you don't have to calculate all possible groupings with DAX formulas.
The very nature of Power BI is that you use a column like "Termination Reason" on an X axis or in the legend of a visual. Any measure that you have created on values of another column, for e.g. a count of all rows, will then automatically be calculated to be grouped by the values in "Termination Reason", giving you a count of each of the values in the column.
You do NOT need DAX functions to calculate the grouping values for each measure for each column value combination.
Here is some simple sample data that has been grouped into dates and colours, one chart showing a count of each colour and one chart showing a sum of the Value column. No DAX was written for that.
If your scenario is different, please explain.

Highlighting with slicer Power BI

I have a Dashboard with different visuals.
Data is made up of different values for insurance companies.
I want my slicers/filters to not filter all data, but to only highlight the chosen company.
For example, in my slicer I choose the insurance ABN.
Instead of showing me the value for ABN only in my visuals, I want all other values to still be visible and ABN's value to be highlighted in the visuals.
Does anyone know how to do this?
You can use conditional formatting to achieve this. Lets say that we will change the background color to "highlight" a row (or cells, to be precise).
First, we need a slicer, which will not filter our data. We can do this by duplicating our source table, removing the unnecessary columns and making sure there is no relationship between the source and the duplicate. So if we have a source table, named Table, like this:
Right click on it and select Duplicate:
Then right click the title of the column you want to keep and select Remove Other Columns to get a list of company names only (you may also remove the duplicates, but it's not required). Then in the model delete the relation between both tables:
Now you can place a table showing company name and sales from your data source, and a slicer for company name from the duplicate table. At this point selecting values in the slicer should not affect the table.
Now you need to capture the value of the slicer and use it in a measure, which will determine should current row be highlighted or not. You can use SELECTEDVALUE for that, but note that it will give you a value only if there is a one selected in the slicer. If you want to support highlighting of more than one company, it gets a bit more complicated.
Make a new measure in your source table, like this:
Measure = IF(HASONEVALUE('Table (2)'[Company name]);
IF(SELECTEDVALUE('Table (2)'[Company name]) = MAX('Table'[Company name]); 1; 0);
IF(ISFILTERED('Table (2)'[Company name]) && COUNTROWS(FILTER('Table (2)'; 'Table (2)'[Company name] = MAX('Table'[Company name]))); 1; 0))
In case there is only one value selected in the slicer (see HASONEVALUE), then our measure will return 1 (highlight) or 0 (don't), comparing it with the current row.
Otherwise (i.e. there is no selection in the slicer, or there are 2 or more companies selected), then we will look at the filtered list of companies (Table (2)) - if it contains current row, then 1 (highlight), otherwise 0 (don't). But we will also handle the case, where there is no value selected in the slicer. In this case the list will contain all the companies, i.e. all rows will be highlighted. Here comes ISFILTERED. And at the end, if the list is filtered and current row exists in the filtered list, then 1 (highlight), otherwise 0 (don't).
Now, you need to use this measure to change the background of the column - right click each column in your table and select Conditional formatting -> Background color:
Then format by rules, where Measure >= 1 like this:
Now, when there is no selection in the slicer, there are no rows highlighted in the table:
If you select one company, it is highlighted:
It also work if there are multiple companies selected:
Thank you Andrey for your step-by-step explanation which as been incredible helpful. I'd like to follow up with a further question, particularly regarding the comment below.
"You can use SELECTEDVALUE for that, but note that it will give you a
value only if there is a one selected in the slicer. If you want to
support highlighting of more than one company, it gets a bit more
complicated."
In my model, I've linked a third table (Table (3)) to Table (2) with a many to one relationship with Table (2). Therefore when I click on Table (3), it will filter Table (2), which acts as a slicer for Table (1).
When only 1 value is filtered in Table (2), it conditionally formats the cells in Table (1). However, when more than 1 value is filtered in Table (2), conditional formatting fails.
As I'm looking to avoid manually selecting multiple values in the slicer (Table (2)), I was wondering if there's a workaround for SELECTEDVALUE such that it is able to conditionally format when I filter more than 1 value in Table (2).

Google Sheets For Filtered Drop Down

I have two sheets: CONTACTS and UPDATES.
On the CONTACTS sheet there are 2 columns: COMPANY and NAME. If I have 10 contacts at a company, then there will be 10 rows with the same company in column 1, and the names of the 10 people in column 2. Now of course there's a lot of companies and names on this list.
On the UPDATES page, column 1 is a drop down that lets me select the name of the company. In column 2 I want to have a pull down that filters and shows me only the people in the company that's in column 1.
I've searched quite a bit and while I have found things that are similar, none of the tips are quite right / work for my use case.
Is there an easy way to do this?
Thanks for your help!
You can use UNIQUE + FILTER to filter the results, but that won't give you the a dropdown. For a filtered dropdown, you can use the formula to get the filtered list and then use that as your range.
For example, in your CONTACTS tab, add a new column FilteredList, with this formula in the first row:
=unique(filter(B:B,A:A=E1))
where B:B is the NAME column, A:A is the COMPANY column and E1 is where you select the company name on the UPDATES page.
Now, instead of making the NAMES list as your valid entries, set it to FilteredList.

Joining grouped tables

I have two different scripted data sets that I am pulling data from and aggregating (on the same key). What I want to do is to display one one line the aggregated data from both sources. The data is coming from a scripted data source (POJOs).
A simplified example is given below in which an Order has many Components, with each component being for a different customer at a different quoted price. Then when each Order is filled in different lots (or Fills) at different prices. I want to be able to produce a summary of each Order with the total Ordered and Filled quantity, and the weighted average quoted price and filled price.
An Order Component table
Order ID, Customer Num, Qty, Quoted Px
Ord01,Cust01,3,100
Ord01,Cust02,3,102
Ord02,Cust01,5,200
Ord02,Cust03,5,204
And then a Order Fullfillment table
OrderID,FillId,Qty,CostPx
Ord01,F01,4,100
Ord01,F02,2,106
Ord02,F03,2,200
Ord02,F04,8,210'
I would like to display something like this:
Order ID, Order Qty, Fill Qty, Avg Order Px, Avg Fill Px
Ord01, 6, 6, 101, 102
Ord02, 10, 10, 202, 208
I've tried using subreports and that seems to be able to get me the results but in a terrible format. The subtable headers repeat so every order gets it's own headers.
You may want to create a BIRT joined dataset between your two scripted datasets, based on a full outer join on the "order ID" column, and then use this joined dataset in your report. It should meet your needs.
I solved my problem by more or less following the following guide.
So I created a List linked to my first data source. I then added a group on Order ID so that I had one list row per Order. In the group header I added a 2x1 grid, I placed a table of the Order Components into one side of the grid and a table of Fills into the other. I had to add filters to both of these so that they only contained data for the correct OrderId. I then grouped the tables by OrderId, added my aggregation fields.
All that is left is to set the visibilty. So I set the visibility of the table details to false. In order to only show the table header once (instead of once per order) I added a Running Count aggregation to the List and set the visibiity to invisible when this aggregation was greater than 1.
Was actually quite easy in the end but took me ages to work out how to do it.

Resources