Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a table with values like the following (simplified example):
Country ProductId Sales Spain 1 100 France 1 100 England 1 100 Portugal 1 100 Spain 2 50 France 2 50 England 2 50 Portugal 2 50
What I need is a Set Analysis expression where:
For France, only ProductId = 1 should be included
For all other countries, all ProductId values should be included
I know I can do something like:
If(Country = 'France', Sum({<ProductId={1}>} Sales), Sum(Sales))…but I do not want to use an if() outside the Set Analysis. I want the logic to be fully inside the Set modifier.
Something like this (which I know does not work):
Sum({<ProductId = {if(Country='France', 1, '*')}>} Sales)Is it possible to pass this conditional logic directly into the Set Analysis?
My goal is to avoid row‑level if() and keep everything inside the set.
Thanks
It seems like it would be much easier to just use two sums - one for France and one for everything else - and add those?
That said, the set analysis shouldn't be a problem using the union (+) operator and excluding France from one half:
{$<country -= {'France'}> + <country = {'France'}, ProductId = {1}>}
How about below?
Sum({<Country={'France'},ProductId = {1}>+<Country-={'France'}>} Sales)
The problem is that not always have to do that with France.
If user select all countries, don't have to include only ID 1, but if user select some countries, and if in this list of countries is France selected, it have to include only ID 1.
I think i have to do an IF statement inside set analysis
thanks
Sorry @PabloMC
Your statement is not fully correct or it does not match the formula you would use with statement you wanted to do:
If(Country = 'France', Sum({<ProductId={1}>} Sales), Sum(Sales))
If the rule is that if France is withing possible values then for France use ProductID=1 and for all other countries use all possible products then what we suggested was "almost" correct.
I would adjust this by adding * (intersection) sign for France so that it applies only when France is within possible values, like so:
Sum({<Country*={'France'},ProductId = {1}>+<Country-={'France'}>} Sales)