Aliased joins and renamed metrics inside topics (design pattern)

Colin Zima · Friday Demos · September 13, 2024 · 6:47

A quick design pattern for aliased joins inside topics, including renaming metrics specific to the topic (instead of globally)

Try it yourselfThe full week on docsmodelingworkbook

Transcript

This transcript is auto-generated. Names and product terms may be wrong.

  1. while I have the mic I have a quick one um and this is also a call out to all the sort of sales Engineers if we have really good patterns for analytics it's worth presenting them because it sort of documents how people do things so uh AK and I have been working on ARR recently and I wanted to quickly show off how we modeled it because I think this is actually a pattern that a lot of folks could lean on so uh there's a bunch of joins everything up here is pretty vanilla there's you know an opportunity line items there's some date stuff some field filters um some always filters where it starts gets interesting is um when we start using actually some of the

  2. topic specific stuff here um so we're building a bunch of opportunity items out of Salesforce we're collecting information about them and then we're grabbing a variety of different dates about the opportunity so that we can actually look at AR a bunch of different ways so you can see that we've got opportunity line item facts which is I believe this a a query view built off of this topic we're joining it back in and you can see that we're joining it back in based on the opportunity start date the opportunity end date and the current date and the reason we're doing that is so that we can look at what our ARR looks like at the start of a contract at the end of a contract

  3. and literally today on the contract um which may or may not the zero depending on if it was the last year thing um and the reason that we are uh doing this inside the topic is because we're joining this multiple times and this is really only relevant inside the sort of ARR view now the complement to this is when we join this fact table back we're bringing in a whole bunch of these fields and we can go look at Opportunity line item if we want to see this um we can go look at it and you can see that it's a pretty basic fact table it's got a handful of fields on it like the first line item the last line item the close date

  4. the opportunity name um and uh some ARR stuff in here as well uh so when we join this back we actually want to rename the fields because when we're in the UI looking at this stuff if we're looking at Opportunity line item start facts it's really helpful to see that field as starting daily recurring revenue or starting annual recurring Revenue as opposed to just saying you know drr sum or ARR sum and so what we're doing is we're actually doing the views where we are extending the fact table in place so we're taking that vanilla opportunity line items daily facts and we're talking about a file called opportunity light item starting fact so an alias view that extends that view and literally just renames these

  5. two Dimensions so this is just a really really clean implementation of taking four fields or or you know two Fields across three topics or three uh views renaming them only in the context of this View and being able to hide everything else so um it's just it's a really really nice pattern and to show what that looks like in the UI uh you know we're revealing our ARR in uh 2023 February it was quite low for the Curious um but you can see that inside these topics now we have current ARR ending ARR starting ARR um and they're named properly so that when we add them into the table it all just makes sense so for people that are doing aliasing um I think this

  6. idea of bringing in relationships and actually extending the views in place is a really really nice pattern um and it's taking advantage of all the stuff that we do around you know views and topics extensions relationships and topics you can really chain these things together in a very elegant way um so uh props to the the model dialects team for making all the stuff out there because this is like a really really clean way of putting everything in one place to be clear this isn't actually out there okay a couple little things that need to happen for the topic scope views um but I could tell that people are really interested in it because I am now starting to see it in the wild as

  7. well so thanks for sharing your demos and uh we'll be sure to polish off the the rough edges as soon as possible Conor can you say it's not really out there it is actually in for enough it's just we're not telling people about it it's in production it's not you won't autocomplete views under opics so we've essentially we've treated as it's kind of like private beta if you will uh in that we haven't you know we're not like autocompleting and it's not documented and so there's no like way for a user to discover it on their own besides obviously watching these demos uh and the reason for that is there are two known shortfalls right now one is you're going to get really weird Behavior

  8. if you do anything with these views in the context of the the workbook UI based model editing and the second is that you will probably get some bad behavior if you try and do um like a sql-based view or a query based view because our type in just isn't being applied to those views at this time so there's a there's a couple like fall one things that uh that I need to take care of that just aren't quite there uh and they keep getting pushed off because other priorities the the extension rename is killer though like yout if for nothing else like when you join in uh contact in Salesforce and some of them are AES or se's or whatever being able to rename name

  9. like sales engineer as like an extension in place is insanely powerful without kind of polluting the model with a whole file yeah without sidetracking it too much I wonder if we should just take an hour or two to just basically say like SQL not supported updating and workbook not supported and then just put it out there I think that would be completely fine like we can always layer those things on later but like I I don't think that's probably a good use case for this anyway you like dropping the SQL Block in just like make a file at that point it seems that people really want to just tweak the metadata and that works great right now as long as you don't try to in

  10. the work that is definitely where it's the most powerful that makes sense