File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
docs/pages/guides/recipes/data-modeling Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -7,14 +7,23 @@ redirect_from:
77
88## Use case
99
10- We want to know the ratio between the number of people in a particular city and
10+ In some cases we may want to let a user select a filter value and be able to
11+ use that value in calculations without filtering the entire query.
12+
13+ In this exmaple, we want to know the ratio between the number of people in a particular city and
1114the total number of women in the country. The user can specify the city for the
1215filter. The trick is to get the value of the city from the user and use it in
1316the calculation. In the recipe below, we can learn how to join the data table
1417with itself and reshape the dataset!
1518
1619## Data modeling
1720
21+ Essentially what we will be doing is cross joining all city values with the rows in the data table.
22+ This will duplicate each row for every city in the dataset. Then, we will require the user
23+ to choose a city to filter on, and this will bring us back to our original number of rows. What this
24+ gives us is a new column in the dataset with the value that the user chose, which we can reference in our metrics.
25+ In this case, we will use that value to filter a single metric so that we can compare that metric with the whole population.
26+
1827Let's explore the ` users ` cube data that contains various information about
1928users, including city and gender:
2029
You can’t perform that action at this time.
0 commit comments