I have to pick the highest value from col 2 in relation col 1 using Tableau. The data is as follows
col 1 col 2
category 1 5
category 2 6
category 1 4
category 1 3
category 2 10
category 1 1
category 2 3
The desired solution is
col 1 col 2
category 1 5
category 2 10
I tried using the fixed aong with max function but in this case it outputs boolean value which I do not need. Could someone help me!
Thank you
Drag col 1 in the rows shelf.
Double click col 2.
Right-Click col 2 --> measure --> Maximum
(Eventually) Drag Max(col 2) from row shel to Text Mark
EDIT
See the screenshot as an example.
[To be noted that you can achieve this simple result with differnt ways/clicks]
BTW: are you familiar with dimensions and measures? it seems to me that you may need some basics training/study in order to get familiar with Tableau basics.
You may start from here: https://www.tableau.com/en-gb/learn/training/20212
would like to find out the syntax in tableau, given column number, trying to generate rows for number in decreasing order down to 0.
Below is an example of what I'm trying to do
BEFORE
ID
NUMBER
A
4
B
5
AFTER
ID
NUMBER
A
4
A
3
A
2
A
1
B
5
B
4
B
3
B
2
B
1
If your Tableau version supports, try using ROWNUMBER with order by. Something like this:
{ ORDERBY [Your column]:ROW_NUMBER()}
Given a table with data like:
A
B
Qty.
Running Total
5
5
5
10
5
15
I can create the running total using the formula =SUM($A$2:A2) and then drag down to get the running total after each quantity (here Qty.)
What may I do for calculating running total using two columns which may or may not be consecutive as shown below:
A
B
C
D
Qty. 1
Other
Qty. 2
RT
2
blah
2
4
2
phew
2
8
3
xyz
2
13
Place in cell D2 the formula =SUM(A2,C2,D1). Do not pay attention to the fact that the function will refer to a non-numeric cell D1 - the SUM() function will not break, unlike ordinary addition =A2+C2+D1. Now, just stretch the formula down.
I am new to MSTR and trying to build a new Dossier and i got stuck on the below issue.
I have 2 attributes and 1 metric in my dataset and Attribute 1 has data A, B & C and Attribute 2 has data X, Y, Z. i want dashboard to look like this
Attribute Metric
A 1
B 2
C 3
X 4
Y 5
Z 6
When i create my result look like below.
Attribute1 Attribute2 Metric
A X 1
B y 2
C z 3
Please help.
Can you reformat your results - Attribute Metric A 1 B 2 C 3 X 4 Y 5 Z 6
I think you mean you want to view metrics for the elements for both the attributes appended one below the other.
I'd suggest you create a consolidation / custom group object and add all elements from both your attributes.
And use this consolidation / custom group instead of the attribute on your report.
To be generic the issue is: I need to create group means that exclude own group observations before calculating the mean.
As an example: let's say I have firms, products and product characteristics. Each firm (f=1,...,F) produces several products (i=1,...,I). I would like to create a group mean for a certain characteristic of the product i of firm f, using all products of all firms, excluding firm f product observations.
So I could have a dataset like this:
firm prod width
1 1 30
1 2 10
1 3 20
2 1 25
2 2 15
2 4 40
3 2 10
3 4 35
To reproduce the table:
firm=[1,1,1,2,2,2,3,3]
prod=[1,2,3,1,2,4,2,4]
hp=[30,10,20,25,15,40,10,35]
x=[firm' prod' hp']
Then I want to estimate a mean which will use values of all products of all other firms, that is excluding all firm 1 products. In this case, my grouping is at the firm level. (This mean is to be used as an instrumental variable for the width of all products in firm 1.)
So, the mean that I should find is: (25+15+40+10+35)/5=25
Then repeat the process for other firms.
firm prod width mean_desired
1 1 30 25
1 2 10 25
1 3 20 25
2 1 25
2 2 15
2 4 40
3 2 10
3 4 35
I guess my biggest difficulty is to exclude the own firm values.
This question is related to this page here: Calculating group mean/medians in MATLAB where group ID is in a separate column. But here, we do not exclude the own group.
p.s.: just out of curiosity if anyone works in economics, I am actually trying to construct Hausman or BLP instruments.
Here's a way that avoids loops, but may be memory-expensive. Let x denote your three-column data matrix.
m = bsxfun(#ne, x(:,1).', unique(x(:,1))); % or m = ~sparse(x(:,1), 1:size(x,1), true);
result = m*x(:,3);
result = result./sum(m,2);
This creates a zero-one matrix m such that each row of m multiplied by the width column of x (second line of code) gives the sum of other groups. m is built by comparing each entry in the firm column of x with the unique values of that column (first line). Then, dividing by the respective count of other groups (third line) gives the desired result.
If you need the results repeated as per the original firm column, use result(x(:,1))