Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
Intentar obtener datos utilizando esta consulta agregando la función Switch similar al caso cuando se usa switch pero no funciona.
EVALUAR
RESUMIRCOLUMNAS (
'Geo Jerarquía'[País],
«Jerarquía prod»[Producto Lvl 1],
«Jerarquía prod»[Producto Lvl 2],
«Jerarquía prod»[Producto Lvl 3],
SWITCH('Prod Hierarchy'[Product Lvl 7],{"Play"},"Play",
{"Ejecutar"},"Ejecutar",
"Otros"
),
FILTRO (
VALORES ( 'Geo Jerarquía'[País] ),
'Geo Hierarchy'[País], IN { "Latam","US"}
),
"Ingresos totales", [RevUSD]
)
En SUMMARIZECOLUMNS, la expresión de filtro debe ir antes de las nuevas columnas y debe asignar un nombre de columna. (https://dax.guide/summarizecolumns/)
(https://www.sqlbi.com/articles/introducing-summarizecolumns/)
Creo que también tiene un problema porque SUMMARIZECOLUMNS no tiene un contexto de fila, por lo que SWITCH no funciona. (Ver el artículo anterior)
Estoy lejos de una computadora, pero intentaré reescribir más tarde si lo anterior no ayuda.
Permítanme profundizar en la pregunta, a continuación encontraremos una vista prevista de SQL y DAX que no funciona ya que la intención es tener menos filas importadas.
SQL
Con PreTable como (
Escoger
«Geo Jerarquía»[País],«Jerarquía Prod»[Prd Lvl 1],«Jerarquía Prod»[Prd Lvl 2],
caso cuando 'Prod Hierarchy'[Prd Lvl 3] como '%crawl%' y luego 'crawl'
cuando 'Prod Hierarchy'[Prd Lvl 3] como '%walk%' y luego 'walk'
cuando 'Prod Hierarchy'[Prd Lvl 3] como '%run%' y luego 'run'
else 'Otros'
fin [NewLvl3],
SUM([TotalRev]) como [Rev]
de ServicePack
donde 'Calendario'[Año]='2019'
Agrupar por
'Geo Hierarchy'[País],'Prod Hierarchy'[Prd Lvl 1],'Prod Hierarchy'[Prd Lvl 2],'Prod Hierarchy'[Prd Lvl 3]
)
Escoger
'Geo Hierarchy'[País],'Prod Hierarchy'[Prd Lvl 1],'Prod Hierarchy'[Prd Lvl 2],[NewLvl3],SUM([Rev])[Rev]
de PreTable
Agrupar por
'Geo Hierarchy'[País],'Prod Hierarchy'[Prd Lvl 1],'Prod Hierarchy'[Prd Lvl 2],[NewLvl3]
DAX (no funciona)
EVALUAR
RESUMIRCOLUMNAS (
«Geo Jerarquía»[País],«Jerarquía Prod»[Prd Lvl 1],«Jerarquía Prod»[Prd Lvl 2],
SWITCH(SELECTEDVALUES('Prod Hierarchy'[Prd Lvl 3]),
"crawl","crawl",
"ejecutar","ejecutar"
"Otros"
),
FILTRO (
VALORES ( «Calendario»[Año]),
'Calendario'[Año] EN { "2019"}
),
"Rev", [TotalRev]
)
¿Puede compartir algunos datos ficticios y asignaciones de relaciones de tabla? Debería ayudarnos a aclarar su escenario y probar la fórmula de codificación.
Cómo obtener respuestas a su pregunta rápidamente
Para las piezas del interruptor, puede probar como estas:
SWITCH (
TRUE (),
SEARCH ( "crawl", 'Prod Hierarchy'[Prd Lvl 3], 1, BLANK () ), "crawl",
SEARCH ( "run", 'Prod Hierarchy'[Prd Lvl 3], 1, BLANK () ), "run",
"Others"
)
De SQL a DAX: Comparación de cadenas - SQLBI
Saludos
Xiaoxin Sheng
@juanroblesoct9 Probar:
SWITCH('Prod Hierarchy'[Producto Lvl 7],"Play","Play",
"Ejecutar","Ejecutar",
"Otros"
),
Si es una medida, es posible que tenga que usar una agregación alrededor de su columna, si es una columna.
Es una columna como se desea replicar caso cuando en SQL.
La sugestión no está funcionando.
el error mostrado "No se puede determinar un solo valor para la columna "Prod Lvl7" en la tabla "Prod Hierarchy". Esto sucede cuando una fórmula de medida se refiere a una columna que contiene muchos valores sin especificar una agregación como min, max, count...
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
1 | |
1 |