I have tried each of the following formulas to get the highest number when I have a duplicate record. They both give me what appears to be the same output, but I know of at least one ID# where the response for both is "6" when I am expecting "7".
F2 = ID# to look for
PSStatus!$A = Hour; data ranges from 1 to 7; column is formatted as a number.
PSStatus!$F = ID#s
=INDEX(QUERY(PSStatus!$A$2:$A,,), MATCH(MAX($F2), (QUERY(PSStatus!$F$2:$F,,)),0))
=MAX(INDEX(QUERY(PSStatus!$A$2:$A,,), MATCH($F2, (QUERY(PSStatus!$F$2:$F,,)),0)))
I'll assume that your data table looks like the following one. Please, forgive me if I am mistaken.
If my assumption is correct, you can use the formula =MAX(FILTER({DATA TABLE RANGE}, {ID COLUMN FROM DATA TABLE}={ID})). That formula will first use FILTER to pick only the requested ID and then MAX will pick the highest one. In my example above, the formula should be =MAX(FILTER(Sheet1!$A$2:$B$26, Sheet1!$A$2:$A$26=A2)) for the first row. This is the end result:
Please, ask me anything if you need further help.
Related
I have a dataframe with column abc having values like below
[{note=Part 3 of 4; Total = $11,000, cost=2750, startDate=2021-11-01T05:00:00Z+0000}]
Now I want to extract data based on name,for example i want to extract cost and start date and create a new column.
Asking it to be working on name because the order of these values might change.
I have tried below line of code but due to change in the data order I am getting wrong data.
df_mod = df_mod.withColumn('cost', split(df_mod['costs'], ',').getItem(1)) \
.withColumn('costStartdate', split(df_mod['costs'], ',').getItem(2))
That's because your data is not comma-separated, it just looks like that. You'll want to use regexp_extract to find the correct content.
The logic which we are trying to achieve in single query is as follows.
We need to loop based on row number column. So, on each loop we need to sum-up remaining value and new value.. resultant value to be updated in "by summing up column". and the decimal part to be updated in decimal value column.
in next step, need to sum-up the decimal value column by grouping on row number. and the resultant to be updated in remaining value column of next row number
the above step 1-2 to be continued till we reach last record.
We achieved this through while loop.. But trying to achieve this without while loop.
Can someone please give idea to achieve this
Please refer the attached image for understanding table
enter image description here
I have the following pivot table
I want to get the max value from each row, but also, I need to get the column it came from.
So far I know who to get the max row of every column using this:
dff['State'] = stateRace.max(axis=1)
dff
I get this:
which is returning the correct max value but not the column it came from.
You suffer a disadvantage getting help because you have supplied images and the question is not clear. Happy to help if the below answer doesn't help.
stateRace=stateRace.assign(max_value=stateRace.select_dtypes(exclude='object').max(axis=1),\
max_column=stateRace.select_dtypes(exclude='object').idxmax(axis=1))
I have the following question!
I have a table like this:
Data Source
I want to create a field(i suppose it's a field) that i can take the apl_ids,
that have as service_offered some that i want.
Example from the above table. If i want the apl_ids that have ONLY the service_offered
Pending 1, Pending 2 and Pending 7.
In that case, I want to get the apl_id = "13" since apl_id = "12" got one more service that i don't need.
Which is the best way to get that?
Thank you in advance!
Add a calculated field which gives 1 for desired values and 0 for other values. Add another calc field with fixed LOD to apl_id to sum of calcF1. Filter all ids with values=3 only. I think that should work.
Else tell me I will post screenshots
You can create a set based on the field api_id defined by the condition
max([service_offering]=“Pending 1”) and
max([service_offering]=“Pending 2”) and
max([service_offering]=“Pending 7”) and
min([service_offering]=“Pending 1” or [service_offering]=“Pending 2” or [service_offering]=“Pending 7”)
This set will contain those api_ids that have at least one record where service_offering is “Pending 1” and at least one record with Pending 2 ... and where every record has a service offering of 1, 2 or 7 (I.e. no others)
The key is to realize that Tableau treats True as greater than False, so min() and max() for boolean expressions correspond to every() and any().
Once you have a set of api_ids() you can use it on shelves and in calculated fields in many different ways.
I have one table with rows and each row has a column that contains a field name (say raw1 - 'Number001', raw2-'ShortChar003', etc). In order for me to get that value of these fields I have to use a second table; this table has 1 raw with many columns (number001, Number002, ShortChar003, etc).
How can I extract the value?
Good Question..You can use lookup function
=Lookup(Fields!CityColumn.Value, Fields!CityColumn.Value, Fields!CountColumn.Value, "Dataset1")
Or you might have to use string functions..ex LEFT, Substring, Right same like SQL.If possible pls post some data of both tables, I will explain in detail