I have a dataframe with 15 columns and I want to create dropdowns out of those columns populated by dependency on each other. For example, if my first column is 'country' and if I select 'France' then I want all other 10 dropdowns to change their values accordingly to what is in the dataframe for France.
Also, every time I change values in my dropdowns, I want to make different plots acoording to what has been selected in a columns_to_plot dropdown. I have tried everythign I could think of but nothing seems to work and there are no complex examples online where many dropdowns interact.
Example:
dropdown_country = [France, Spain, ....]
dropdown_year = [1991, 1992, ...]
dropdown_car = [BMW, Opel, ...]
dropdown_color = [blue, black, ...]
Those are the columns I want to plot against country, year and car columns for example (the rest of columns in a dataframe are listed in this dropdown, not their values as in dropdowns above):
columns_to_plot_dropdown = [total, sales, ....]
So if I select France in a country dropdown I want to see only years in a year dropdown that correspond to France and only cars that correspond to France in year 1992. Color dropdown also needs to be updated only for France in 1992 and selected type of car.
Then if I select sales column in columns_to_plot dropdown I want to plot country, year, car and color columns for sales.
I have tried Python Interact widgets and Dash as well but couldn't make it work. Any help would be much appreciated.
Related
I have three numeric fields named A,B,C and wants them in a single filter in tableau and based on the one selected in that filter a line chart will be shown. For e.g. in filter Stages B column is selected and line chart of B is shown. Had it been column A selected then line chart of A would be displayed .
Pardon my way of asking question by showing a image. I just picked up learning tableau and not getting this trick any where.
Here is the snapshot of data
Create a (list) parameter named 'ABC'. With the values
A
B
C
Then create a calculated field
IF ABC = 'A' THEN [column_a]
ELSEIF ABC = 'B' THEN [column_b]
ELSEIF ABC = 'C' THEN [column_c]
END
Something like that should work for you. Check out Tableau training here. It's free, but you have to sign up for an account.
Another way without creating a calculated field. Just pivot the three columns to rows and your field on which you can apply filter is created. Let me show you
This is screenshot of input data
I converted three cols to pivots to get data reshaped like this
After renaming pivoted-fields column to Stages I can add directly this one to view and get my desired result.
I have 2 large tables in power pivot and I am trying to reconcile stockpile build grades to crushed stockpile grades. Please see example. I can create pivot table that contains the crushed grades but I am unable to find the right way to bring the stockpile grades though for the reconciliation high lighted in green in the attached example.
Thanks for any help or direction on where to look
In Power Query, create your lookup tables.
1) unique crushers, ID
2) Dates, ID
Here is a function to create a dates table, if you need one. After you invoke the function to get the column of dates, add another column for the ID.
/*--------------------------------------------------------------------------------------------------------------------
PQ Create a Dates Table, returning a single column of dates.
Inputs:
Start Date | Enter the year as yyyy, month as mm, day as dd
End Date | Enter the year as yyyy, month as mm, day as dd
Increments | One row will be returned per increment.
Author: Jenn Ratten
Edits:
07/16/18 | Modified query copied from the internet.
10/01/19 | Converted to a function.
--------------------------------------------------------------------------------------------------------------------*/
let
fDatesTable = (StartYear as number, StartMonth as number, StartDay as number, EndYear as number, EndMonth as number, EndDay as number, IncrementDays as number, IncrementHours as number, IncrementMin as number, IncrementSec as number) as table =>
let
StartDate = #date(StartYear,StartMonth,StartDay),
EndDate = #date(EndYear,EndMonth,EndDay),
Increments = #duration(IncrementDays,IncrementHours,IncrementMin,IncrementSec),
DatesTable = Table.FromColumns({List.Dates(StartDate, Number.From(EndDate) - Number.From(StartDate), Increments)}, type table[Date]),
ChangeType = Table.TransformColumnTypes(DatesTable,{{"Date", type date}})
in
ChangeType
in
fDatesTable
Load all of the tables to the data model.
Go to Power Pivot, diagram view, and create your relationships.
Lookup Crusher to data tables 1 and 2
Lookup Date to data tables 1 and 2
Go to Data View on data tables 1 and 2, add 2 new columns for the lookup IDs. You can specify the column header and the formula at one time by clicking in first cell and using this syntax, then either press enter or click the check mark in the formula bar.
Dates Lookup ID:=RELATED(lookup_dates[ID])
Crusher Lookup ID:=RELATED(lookup_crusher[ID])
Optional, but a good practice....
Right-click the new fields you just created and select "hide from client tools". Also hide the date and crusher fields on both data tables, and the ID field on both lookup tables. When you are creating pivots to summarize data from more than one table, the text fields that you place on your pivot table should be the fields that are shared (aka the lookup tables). This helps to minimize pivots in which the grand totals don't match the sum that you actually see on the table. If you hide the fields, it reminds you of that. There are exceptions of course, but this is a good rule of thumb.
Now create measures to sum the tons and any other math calculations you'd like. With the measures, start simple and let the pivot do the slicing. Put the measures in the values section of the pivot table.
Sum of Source Tons:=sum(Table1[Tons])
Sum of Destination Tons:=sum(Table2[Tons])
I'm trying to create a dropdown on sheet1 from data on sheet10. I cannot add a new column on sheet10, so I need to dynamically create the dropdown. There will be at least 1500 rows on Sheet10, but the dropdown needs to only list Column2 if the column4 matches a value on Sheet1!A1.
Ideally, the pulldown will concatenate the two Columns (e.g. "Column2(Column4)" but that is gravy.
I've tried several similar answers on this sight, but most require creating a column of the subset, then creates Formula:Name, then Data validation. I've tried making the NAME item WITHOUT creating the helper column using FILTER and OFFSET and some others...
Sheet1:A1 = My Department
Sheet1!B3:B500 "MyNewDropList" Data validation.
Sheet 10!
REF DOC TASK DATE ORG
------- ------ -------- -------
DOC 1 TASK 1 1/1/2000 My Department
DOC 1 TASK 2 1/1/2000
DOC 1 TASK 3 1/1/2000 My Department
DOC 1 TASK 4 1/1/2000
DOC 1 TASK 5 1/1/2000 Your Department
I would like to have a dynamic dropdown on Sheet1!B2:B550 that will include the values in SHeet10!B2:1500 if the "ORG" = the value in Sheet1:A1 (In this case "My Department" If possible, I would like to include ORG in the dropdown.
With the values above, I would need the pulldown in SHeet1! Column B, to show:
TASK1
TASK3
Or better would be:
TASK 1 (My Department)
TASK 3 (My Department)
The dropdown needs to be dynamic so that if The value any value in ORG is changed to "My Department", then the dropdown would need to include the new TASK meeting the My Department criteri
Since I can't add a column, I've decided to create a separate worksheet. From here I've created my dynamic list, created a name (excluding the blank lines). I now have my pulldowns working, but was hoping to do so without creating the separate worksheet.
How would I group columns in a pivot table, collapse the group, and rename the label given my pivot table "PivotTable1" look like the following:
As you can my column labels are dates. Normally I would have to manually shift+click dates together and right click to group them into "Group#" Then rename the label into something more meaningful such as "Q1 2019" etc.
As you can see the 2 things I did above are grouping months Jan, Feb, Mar of 2018 together into one group, and renamed the label "Q1 2019".
Now this process becomes very time consuming and repetitive when the file goes off to 2030+ so I was wondering if there's any way to achieve this via VBA?
Again the goals of the macro would be:
Group column labels using some criteria - in my case grouping dates
together into quarters.
Renaming the newly grouped column labels
Collapsing the newly created groups.
I can rename with something like the following.
Sheets("Sheet1").PivotTables(1).PivotFields("date").PivotItems("rdates").Caption = "Q1 2019"
Also I can manipulate pivotfields' attributes
ActiveSheet.PivotTables("PivotTable1").PivotFields("date").Orientation =
xlHidden
With ActiveSheet.PivotTables("PivotTable1").PivotFields("date")
.Orientation = xlRowField
.Position = 2
End With
but not sure how you would be able to group by criteria? I.E all jan-mar = Q1 + year
I have a data returning in a data set that looks like this:
Department 1 Product Name Units
Department 1 Product Name Units
Department 2 Product Name Units
Department 2 Product Name Units
Department 3 Product Name Units
Department 3 Product Name Units
I have added a Group Band that will group by Department and in the group footer band a summary that will sum units by Department.
I want to show a bar chart with the Department as the argument and the Units as the value. But all I get in the report is each record repeated in the chart, i.e. not grouped by Department. Do I need to define a relationship and use that as argument in the chart series?
You have to use the AutoSeries properties (under Series tab) in order to get your data grouped by something This way you would have a different serie for each different value you used on your Auto Series Key Data Column