Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Was wondering if someone could help me find a better way to do this.
I have about 20 ratios that I need in a chart. I'm struggling with an expression to add them all into one expression.
Example
1. Select a Filter (Product)
2. Chart calculates the Ratio (um({$<Measure = {'AAAA'}>} Visits) / sum({$<Measure = {'BBB'}>} Visits)))
if(Product = 'xxx1', sum({$<Measure = {'AAAA'}>} Visits) / sum({$<Measure = {'BBB'}>} Visits))
if(Product = 'xxx2', sum({$<Measure = {'CCCC'}>} Visits) / sum({$<Measure = {'DDD'}>} Visits))
if(Product = 'xxx3', sum({$<Measure = {'EEEE'}>} Visits) / sum({$<Measure = {'FFFF'}>} Visits))
Thanks in Advance
HI,
Try Pick() function
=Pick(match(Product ,''xxx1','xxx2','xxx3'),
sum({$<Measure = {'AAAA'}>} Visits) / sum({$<Measure = {'BBB'}>} Visits),
sum({$<Measure = {'CCCC'}>} Visits) / sum({$<Measure = {'DDD'}>} Visits),
sum({$<Measure = {'EEEE'}>} Visits) / sum({$<Measure = {'FFFF'}>} Visits))
Thanks,
Sasi
Why not doing the essential work within the script, for example with an extra table containing the product + measure information, like:
t: load * inline [
product, measureX, measureY
abc, AAAA, BBB
...
];
and then using an expression like:
sum({< Measure = p(measureX)>} Visits) / sum({< Measure = p(measureY)>} Visits)
I got the table to work, just cant get the expression to work.
Marcus, thank you for the reply.
This is what the table looks like..
LOAD*INLINE [
Offers, Offer_Clicked, Offer_Shows
[Insurance, Renter's Insurance (Clicked), Renter's Insurance (Shows),
expression: Cant seem to figure this part out.
num(sum({$<Offers = {Offer_Shows}>} Visits)/sum({$<Offers = {Offer_Clicked}>} Visits),0.000)
You put the field-names as value-strings within the condition but you need to reference to the possible values of those fields which could be done like demonstrated above with p() - means the expression should look like:
num(sum({$<Offers = p(Offer_Shows)>} Visits)/sum({$<Offers = p(Offer_Clicked)>} Visits), '0.000')