Forum Discussion
steve
02-21-2024Sisense Employee
Hi enmiwong
You can use Compose SDK without generating a datamodel by dynamically creating 'attributes' using createAttribute in your code. (you'll need to import this from sdk-data)
The minimum needed is the name and expression properties, and depending on the column type you might want more control e.g. granularity and format for date columns.
Expression is a string that consists of the name of the table and column, separated by a period, and enclosed in square brackets as shown below.
value: [
measureFactory.sum(
createAttribute({
name: 'Total Revenue',
expression: '[Commerce.Revenue]',
})),
]
Example of creating a date dimension:
createAttribute({
name: 'Years',
expression: '[Commerce.Date]',
granularity: "Years",
format: 'yyyy'
})
For more information, check this link to the docs.
Hope that helps!