Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to have a fixed (hardcoded) filter on a table of multiple dimensions to filter data while that filter not being user editable.
I see how set analysis can be used on measures but I cannot find a way to filter dimensions of my table.
I guess i could use an alternate state an the whole table but I don't see a function/action to set my alternate state to a specific complex set.
example :
I have following dimensions
I would like to filter:
The idea is to highlight a set of the data source where inconsistencies has been seen, and get a list of these inconsistencies to quantify them.
I guess a set analysis with all those rules could be hardcoded as a state, because an alternate state can then be used upon a table.
but then, the alternate state can be modified by a user using the gui (and we don't want that).
Then how to set the alternate state to these rules.
Is there a function like setAlternateStateTo('stateName', 'set analysis string') that I could use as an action when the sheet loads. Or can we apply an unnamed alternate state (just by defining the filter) to a table object ?
If you apply those sets within the Measure, it will by default filter the Dimensions.
If you want to filter the Dimensions directly, you can do by creating a Calculated Dimension using Aggr and Only.
Aggr(
Only(
{<
vehicle = {'car'},
color = {'red'},
weight = {"<500 >2500"}
>} Name
)
,Name)
Does something like this work for you?
Count(
{<
vehicle = {'car'},
color = {'red'},
weight = {"<500 >2500"}
>} DISTINCT id
)
+
Count(
{<
vehicle = {'train'},
color = {'blue'}
>} DISTINCT id
)
+
Count(
{<
vehicle = {'boat'},
hasWheels = {1}
>} DISTINCT id
)
+
Count(
{<
vehicle = {'bike'},
weight = {">200"}
>} DISTINCT id
)
Just combine the conditions with an OR operator and maybe also using 1 as identifier - it may look like:
count({1< Set1 > + < Set2 >} field)
If you apply those sets within the Measure, it will by default filter the Dimensions.
If you want to filter the Dimensions directly, you can do by creating a Calculated Dimension using Aggr and Only.
Aggr(
Only(
{<
vehicle = {'car'},
color = {'red'},
weight = {"<500 >2500"}
>} Name
)
,Name)
Thank you
It works but the Aggr(Only({...rules...})) has to be copied in each column expressions 😕
I guess I have to find a way to put the ...rules... part in a variable then to have that logic defined one time only.