Role-playing dimensions
AML Extend enables you to implement role-playing dimensions in a concise way without duplication.
Let’s say that you have an Order model that contains information about when an order is first created and delivered. You want to enable users to analyze how many orders are created or received on a given date.
With AML Extend, you can define just one Date model, extend it into different models and use them in your dataset.
You can use AML Extend in the following way:
Model date {
label: 'Dates'
// Details of this dimension are omitted for brevity
dimension date {}
}
Model createdDate = date.extend({
label: "Created Date"
dimension date { label: "Created at" }
})
Model receivedDate = date.extend({
label: "Received Date"
dimension date { label: "Received at" }
})
Dataset ecommerce {
models: [orders, createdDate, receivedDate]
relationships: [
relationship(orders.created_date > createdDate.date, true) ,
relationship(orders.received_date > receivedDate.date, true) ,
]
}
The dataset exploration will look like this: