happy friday:slightly_smiling_face: i have a follo...
# gooddata-platform
m
happy fridayšŸ™‚ i have a following challenge, maybe you could help me to resolve it. my goal is a table like on a spreadsheet screenshot below. i'm trying to create a metric that will give me the sum of reward value by saas state, brand and saas date which corresponds to a reward creation date. also attaching the data model - i want to get from saas_state_date to revard value by created_at date via brand_key but eventually all the saas stuff can only reach brand & metrics that refer to brand directly in BY statement. what would you advise here? thank you much!
f
Hi Masha, happy Friday to you too! šŸ™‚ So you are looking to go ā€œagainst the grainā€ on the LDM connections in order to slice the
Reward Value
fact by the
SaaS State
attribute, correct? This can be achieved via Explicit Lifting, utilizing the BY keyword (as you noted). Based on one of the examples from the article (which is for our Classic UI, but is still functional), you’d be looking for a metric a bit like this:
Copy code
SELECT MAX(( SELECT (( SELECT SUM(Reward Value) BY Brand Key)) BY SaaS State Key))
The article explains in more detail what each part of this metric does, but in short it will allow you to slice Reward Value by
SaaS State
and
SaaS Date
. I’m not sure about comparing the
Created at
date dimension with
SaaS Date
in this example. As I mentioned, you should be able to use the latter to slice this report, but I’d recommend experimenting with the syntax to see if the comparison will work out on your LDM. Let me know if you have any more questions or additional details about the use-case to help us come up with some solution!
m
thanks much Francisco, trying it now
hi Francisco & GD teamšŸ™‚ so i was not able to make it work properly with the dates and i also recalled that i need to take one more element - Display currency - into consideration, any hints on how to refer to it properly? Also wanted to ask about the double brackets '((', didn't find its meaning in the documents but maybe i missaw it. Also would you maybe advise to remodel the somehow more explicitly eg via creating some proper 'fact' for saas part instead of the hybrid dimension that i have now? the reason behind the current approach is that there's basically no fact (numeric) data present, it's just a historical table with the combinations of states and brands for each month. thank you much in advance for your hints!
f
Hi Masha, I’m sorry to hear that didn’t work out. In this case, it wouldn’t be possible to both reach out to the
Dim Saas States
dimension and still be able to slice the metric by
Dim Display Currency
. It is hard to assist with the implementation of LDMs, because they are each so unique to a customer’s data and needs (and it’s also a bit beyond our scope); That said, something that could help you out here would be to invert the connection point between the
Saas States
and
Brand
datasets. This would require adding a reference key from first into the latter, and would also change how they interact: You would be able to slice the data from
Brand
with the
SaaS States
objects. I’m not sure how that would affect your overall use-case, but it would allow for slicing the facts from
Fact Rewards
with these datasets without needing any fancy
BY
metrics. Lastly, the
((
double brackets don’t actually do anything šŸ˜… They were described like that in our classic docs, but they are not necessary. I tested the metric without them and it worked nicely.
šŸ™ 1