Forum Discussion
Creating constants
- 7 months ago
Hi Nerdio ,
Yes you can create a constant table directly in Power BI without importing data from an external location using the DATATABLE() DAX function as a calculated table
For example, the below code would create a table called Sizes with two columns Name and Ordinal holding the values mentioned under them
Sizes = DATATABLE ( "Name", STRING, "Ordinal", INTEGER, { { "Small", 1 }, { "Medium", 2 }, { "Large", 3 } } )Regards,
Thank you for your answer.
Can I create a table for the constants directly in Power BI, instead of importing one? I can't add one to the DB Source for the other data. I could have a separate spreadsheet of course, but a table built-in to Power BI. Sorry for a fairly basic question but I am new to Power BI.
Thanks
Hi Nerdio ,
Yes you can create a constant table directly in Power BI without importing data from an external location using the DATATABLE() DAX function as a calculated table
For example, the below code would create a table called Sizes with two columns Name and Ordinal holding the values mentioned under them
Sizes =
DATATABLE (
"Name", STRING,
"Ordinal", INTEGER,
{
{ "Small", 1 },
{ "Medium", 2 },
{ "Large", 3 }
}
)
Regards,