Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Let's say that I have a CSV of individual product sales where one field is the product name (e.g., "900X") and another is the product type (e.g., "Retail," "Commercial"). I'm trying to show a table where the first column lists the product and the second is the count of the rows for that product provided it's only for type=retail; e.g., I want to do
select name, count(1) from products where type = 'Retail'
For the first column, I want to only include names when the type is "Retail." I tried
{$<type={"Retail"}>} name
but it's not valid. I'm not sure how to say that I just want the value without any wrapping function call.
For the second column, the following appears to be syntactically correct:
count({$<type={"Retail"}>} name)
Any ideas?
Just use the dimension 'name' for the first column. The expression count({$<type={"Retail"}>} name) will filter out the names that aren't of type Retail.
Just use the dimension 'name' for the first column. The expression count({$<type={"Retail"}>} name) will filter out the names that aren't of type Retail.
Okay, so applying the constraint to the count apparently also applies it to the first column.
Thanks
One more quick question: Is there way to constrain widgets that only have dimensions (no measures)? It seems like there ought to be a way to apply constraints to them, e.g.,
({$<field2={"field2value"}>} field1) // no wrapping function
someValueFunction({$<field2={"field2value"}>} field1)
You'll have to use a calculated dimension like this one =if(field2='field2value',field1). Or perhaps aggr(only({<field2={'field2value'}>}field1),field1).