
1. Re: Calculation of max within dimension
Zhouyi Zhang Feb 10, 2018 6:02 AM (in response to Artem Brauner) 
2. Re: Calculation of max within dimension
Artem Brauner Feb 10, 2018 7:10 AM (in response to Zhouyi Zhang)To find out if Client belong to a particular milestone I need to find MAX underlying feature milestone.
I was think about LOD Expressions, but now it looks that some king of data blending should be applied, but I don't know how to write expression like if milestone = max(milestone) by client then 1 else 0

3. Re: Calculation of max within dimension
Zhouyi Zhang Feb 10, 2018 2:38 PM (in response to Artem Brauner)
milestone sample.twbx 14.0 KB


4. Re: Calculation of max within dimension
Artem Brauner Feb 13, 2018 5:48 AM (in response to Zhouyi Zhang)Thank you very much for reply.
I have extended original data set to show where the issue is:
Client1, Feature1
Client1, Feature2
Client1, Feature3
Client2, Feature2
Client3, Feature2
Client3, Feature4
Client4, Feature4
Client4, Feature5
And feature list:
Each feature has it's own milestone e.g.:
Feature1, Milestone1
Feature2, Milestone1
Feature3, Milestone2
Feature4, Milestone3
Feature5, Milestone3
So for the same client in single milestone there would be 2 features. As my original task was to find out number of client per milestone I made the following calculation as you suggested:
Filter_Bool as: [Milestone] = {FIXED [Client]:MAX([Milestone])}
Filter_Number as: if [Filter_Bool] == true then 1 else 0 END
When I am putting Milestone to Rows and Filter_Number to Measures which transform to SUM(Filter_Number) I am having the following:
Milestone

Milestone1 1
Milestone2 1
Milestone3 3 (here instead of 2 I see 3 as it's sums all underlying rows. For Client3 it takes Feature4 and for Client4 it takes both Feature4 & 5)
Does anyone know how to count sum by distinct in this case?

5. Re: Calculation of max within dimension
Artem Brauner Feb 13, 2018 1:07 PM (in response to Artem Brauner)Finally I was able to calculate what I was looking for using the following steps:
1. Create calculation field to find out Max milestone per client using: [Milestone] = {fixed [Client]:MAX([Milestone])}
2. Create another calculation field to find out max feature per client using: {fixed [Milestone],[Client]:MAX([Unique_Feature])} I am not sure how it works and if it's right approach or I should do smth like ({FIXED [userid] : MAX(IF [Created Time] != [Max Created Time] THEN [Created Time] END)})
3. And finally create calculated measure as: if [Unique_Feature] = [Max_Feature_per_Client] and [Max_Milestone_per_Client_Bool] = TRUE then 1 ELSE 0 END
I am not sure if I did this type of task right, will do more testing, but it's very weird because if I just put Client to Columns and Milestone to Rows Tableau by default shows me the following:
Milestone Client1 Client2 Client3 Client4

Milestone1 Abc Abc Abc
Milestone2 Abc
Milestone3 Abc Abc
And it looks not trivial to calculate numbers which are marked as bold per milestone

6. Re: Calculation of max within dimension
Zhouyi Zhang Feb 13, 2018 4:06 PM (in response to Artem Brauner)Hi, Artem
Can you provide the workbook your working on?
ZZ

7. Re: Calculation of max within dimension
Artem Brauner Feb 14, 2018 7:20 PM (in response to Zhouyi Zhang)Here you go.
Is there any way to do this in better way?

Clients_per_Milestone.twb 18.2 KB


8. Re: Calculation of max within dimension
Zhouyi Zhang Feb 14, 2018 7:38 PM (in response to Artem Brauner)can you attach workbook with file extension .twbx?
ZZ

9. Re: Calculation of max within dimension
Artem Brauner Feb 14, 2018 8:23 PM (in response to Zhouyi Zhang)Please find attached

Clients_per_Milestone.twbx 15.7 KB


10. Re: Calculation of max within dimension
Zhouyi Zhang Feb 14, 2018 10:17 PM (in response to Artem Brauner)1 of 1 people found this helpful 
11. Re: Calculation of max within dimension
Artem Brauner Feb 25, 2018 8:58 AM (in response to Zhouyi Zhang)Thank you,
That's 2 steps less than my approach, I would assume this is the easiest way to do this as for now.