Crear partición M
Objetivo del script
Si quieres crear un nuevo parámetro M dinámico para usarlo en consultas de Power Query (particiones M o expresiones compartidas).
Secuencia de comandos
Crear una nueva partición M
// This script creates a new M parameter in the 'Shared Expressions' of a model.
//
// Create a new shared expression called "New Parameter"
Model.AddExpression(
"New Parameter",
@"
""Parameter Text"" meta
[
IsParameterQuery = true,
IsParameterQueryRequired = true,
Type = type text
]"
);
// Provides an output informing how to configure and use the parameter
Info (
"Created a new Shared Expression called 'New Parameter', which is an M Parameter template." +
"\n------------------------------------------------------\n" +
"To configure:" +
"\n------------------------------------------------------\n " +
"1. Replace the text 'New Parameter' with the desired parameter value\n " +
"2. Set the data type appropriately\n " +
"3. Replace any values found in the M partitions with the parameter reference." );
Explicación
Este fragmento crea un nuevo parámetro M en 'Expresiones compartidas', al que puedes hacer referencia desde las consultas de Power Query de tus particiones M.
Salida de ejemplo
