Hi Team, Hoping for some metric advice. I need to...
# gooddata-cn
a
Hi Team, Hoping for some metric advice. I need to create two metrics which “normalize” data. The first data value is always “100” (and becomes the denominator for all subsequent rows.) each subsequent row equals the value *100/ denominator. (Example below.) I’ve tried using last_value and previous but it doesn’t seem to work. Thanks!
i
Hi Alex, What seems to be an issue here, please? Incorrect results or some errors in your analytics? Could you share your actual metric(s) syntax with us, please?
a
Thanks Ivana! I tried a few metrics: For fund a starting value: select sum({fact/FUND_A}) for PREVIOUS({label/FUND_PERFORMANCE_AS_OF_DATE.day}) I tried to get the first value returned on every row (assuming if I could do that I could create a new metric to handle the numerator.) this is the second number column in the attached. It returns the previous value if there is no break in time (unfortunately weekends 😭 cause this to not work.)
For the second metric I tried (third number column in attachment), I used first value select FIRST_VALUE(sum({fact/FUND_A})) order by {label/FUND_PERFORMANCE_AS_OF_DATE.day} (Called “Test”) in the screenshot, but that only returned the current row value
i
Thanks a lot. And the expected results should be actually the results of calculation from your first attachment, correct?
a
Thanks, Ivana! Yes that would be my expectation
@Ivana Gasparekova , any ideas on how to do this?
i
Hi Alex, I am so sorry for not noticing your response earlier, my bad completely. Unfortunately, this is not how the FIRST_VALUE clause was designed to work. Have you considered to add in a condition or a filter to filtered out the weekends, please?
a
@Ivana Gasparekova happy to share that including weekends in my data (i.e no gaps) allowed first_value to work! Thank you!