I have a Share of Sales metric where the numerator is the total Sales but constrained to certain categories, and the denominator is also total Sales but not constrained by category. Formula below:
This works how I want it to, however I also want to have filter on ‘category’. When I put the filter on category and select a certain category (let’s call it ‘Big Accounts‘), the Share of Sales ends up being 100% because both the numerator and denominator are now constrained to Big Accounts.
@David_Wong Thank you. I realize that I actually want some of the filters to work, and others to not. For example, I want the country filter to apply to both the denominator and numerator, but I only want the category filter to apply to the numerator. I’m trying this, but it’s not quite working:
This works when I have one country selected in the country filter, but it does not work when I have multiple countries selected. It doesn’t seem to be related to whether I use min or max. Any advice?
@David_Wong getting very close! The only problem now is that this only works if the country parameter has a default value. However I want all countries to be the default selection. I’ve tried adding ‘ALL_VALUES’ as the default value and incorporating that into the logic, but it’s still not working. Any thoughts?
@Jordan_Hill You can use a parameter in a calculated field only if it has a default value.
I’ve also run into issues using ‘ALL_VALUES’ in the past. I think the best you can do is set the default to some dummy value like “Select a country” or set it to blank.
Hi @Jordan_Hill, the string ‘ALL_VALUES’ is a reserved value, but you can check if the parameter is “All” using in(NULL, ${country}). You can then incorporate that into the logic of the calculated field, such as:
Following up here as it’s been a while since last communication took place on this thread; did you have any additional questions regarding your initial post?
If we do not hear back within the next 3 business days, I’ll close out this topic.
Since I have not heard back further, I’ll go ahead and close out this topic. However, if you have any additional questions, feel free to create a new post in the community.