-
1. Re: Color data based on group granularity
Michel Caissie Jun 12, 2019 10:42 AM (in response to Edward Ostrovsky)Edward,
Assuming that every time you display an extra dimension of the hierarchy, new rows are added to the view.
And assuming you have an idea on the number of rows the view will contain at each level of the hierarchy,
you can compute the size() of the view (nb of rows) and based on the result select to dimension to be used for the color.
In your example, you could use a calculation
if size() <= 4 then ATTR( [Tool Type] )
elseif size() > 4 and size() <= 7 then ATTR( [Tool Name] )
end
compute using table down
In your real scenario, you may not have the precise values of each dimension size but you may be able to guess the boundaries
and return the dimension if the result is between those boundaries.
Michel
1 of 1 people found this helpful-
Book1 (7) (mc).twbx 17.6 KB
-
-
2. Re: Color data based on group granularity
Edward Ostrovsky Jun 19, 2019 9:23 AM (in response to Michel Caissie)Michael Casey, what if I have a date dimension in the rows after Tool Type/ Tool Name?
How can I use size() then, since the length of the date dimension increases every day or so... Thank you
-
3. Re: Color data based on group granularity
Michel Caissie Jun 19, 2019 9:58 AM (in response to Edward Ostrovsky)Edward,
Just add a elseif size() > X then ATTR(Date) where X is the maximum possible number of Tool Type/Tool Name groups.
The challenge does not come from the date dimension but from the estimation of the number of Tool Type-Tool Name combination.
Let say that when Tool Name is Exploded, you have 100 rows. If each tools have an avg of 2 dates, then the size() would be 200 when date is exploded.
So if you put 150 for X, you could still add 50 tools and the solution would still work.
But again , this is not a perfect solution, it implies some guessing , and may need some adjustments in time according to the dataset growth.
ps: my name is Michel Caissie, Michael Casey is another person.
-
4. Re: Color data based on group granularity
Edward Ostrovsky Jun 19, 2019 10:48 AM (in response to Michel Caissie)Michel Caissie apologies about the name confusion.
I don't think I explained correctly since I tried adding the condition you mentioned with date but then it colors at the date level, which isn't what I need.
Attached workbook for reference.
As you can see, when Tool Name is expanded, it colors properly- since there are two tool names and two colors.
However, when it is at the Tool Type level, it doesn't color in one color (since there is just 1 tool type A), since size() doesn't work properly since it becomes the size of the activity dates..
Thank you in advance
-
test.twbx 23.9 KB
-
-
5. Re: Color data based on group granularity
Michel Caissie Jun 19, 2019 11:34 AM (in response to Edward Ostrovsky)Well this is different.
You can try to compute the number of date per Tool Type, sum those dates and compare it with the size()
Color would become
if size()<= MIN( [Day per Tool Type] )then ATTR( [Tool Type] )
else ATTR( [Tool Name] )
end
where Day per Tool Type is
{SUM({FIXED [Tool Type]: COUNTD( DATETRUNC('day', [Activity Date] ) )})}
-
Test (mc)_v10.5.twbx 47.3 KB
-
-
6. Re: Color data based on group granularity
Edward Ostrovsky Jun 19, 2019 1:06 PM (in response to Michel Caissie)Awesome!