Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
jdonovan
Frequent Visitor

Cambio de valores de varias filas a una fila para ID único...

Estoy usando Power BI conectándose a Salesforce para acceder al objeto Historial de campos de oportunidades (tabla). Me gustaría terminar con cada etapa una oportunidad golpea, en orden, en una sola fila para que luego pueda construir un diagrama de flujo para ilustrar tirar a través y caer.

Ejemplo de solución:

OppIDEtapa 1Etapa 2Etapa 3Etapa 4Etapa 5
ABC123ProspecciónCalificaciónEstimarProponiendoCierre

La tabla de datos se configura para registrar los cambios en el nombre de la etapa, de modo que los datos se encuentren de la siguiente manera:

OppIDFechaOldvalueNewValue
ABC1231/1/2020ProspecciónCalificación
ABC1231/2/2020CalificaciónEstimar
ABC1231/3/2020EstimarProponiendo
ABC1231/4/2020ProponiendoCierre

Cualquier ayuda con esto sería muy útil... He estado tratando de resolver esto por algún tiempo. ¡Gracias de antemano!

9 REPLIES 9
v-eachen-msft
Community Support
Community Support

Hola @jdonovan ,

Puede hacer referencia al siguiente DAX:

Column =
RANKX (
    FILTER ( 'Table', 'Table'[OppID] = EARLIER ( 'Table'[OppID] ) ),
    'Table'[Date],
    ,
    ASC,
    DENSE
)
Table 2 =
SUMMARIZE (
    'Table',
    "ID", DISTINCT ( 'Table'[OppID] ),
    "Stage 1", CALCULATE ( SELECTEDVALUE ( 'Table'[OldValue] ), 'Table'[Column] = 1 ),
    "Stage 2", CALCULATE ( SELECTEDVALUE ( 'Table'[NewValue] ), 'Table'[Column] = 1 ),
    "Stage 3", CALCULATE ( SELECTEDVALUE ( 'Table'[NewValue] ), 'Table'[Column] = 2 ),
    "Stage 4", CALCULATE ( SELECTEDVALUE ( 'Table'[NewValue] ), 'Table'[Column] = 3 ),
    "Stage 5", CALCULATE ( SELECTEDVALUE ( 'Table'[NewValue] ), 'Table'[Column] = 4 )
)

Aquí está el resultado de mi prueba.

1-1.PNG

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
Ashish_Mathur
Super User
Super User

Hola

Creo que podemos llevar a cabo algunas transformaciones en el Editor de consultas para resolver esto. ¿Se permiten trnsformations de Power Query cuando soruce directamente datos de SalesForce?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
v-eachen-msft
Community Support
Community Support

Hola @jdonovan ,

Puede hacer referencia al siguiente DAX:

Column =
RANKX (
    FILTER ( 'Table', 'Table'[OppID] = EARLIER ( 'Table'[OppID] ) ),
    'Table'[Date],
    ,
    ASC,
    DENSE
)
Table 2 =
SUMMARIZE (
    'Table',
    "ID", DISTINCT ( 'Table'[OppID] ),
    "Stage 1", CALCULATE ( SELECTEDVALUE ( 'Table'[OldValue] ), 'Table'[Column] = 1 ),
    "Stage 2", CALCULATE ( SELECTEDVALUE ( 'Table'[NewValue] ), 'Table'[Column] = 1 ),
    "Stage 3", CALCULATE ( SELECTEDVALUE ( 'Table'[NewValue] ), 'Table'[Column] = 2 ),
    "Stage 4", CALCULATE ( SELECTEDVALUE ( 'Table'[NewValue] ), 'Table'[Column] = 3 ),
    "Stage 5", CALCULATE ( SELECTEDVALUE ( 'Table'[NewValue] ), 'Table'[Column] = 4 )
)

Aquí está el resultado de mi prueba.

1-1.PNG

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.
parry2k
Super User
Super User

@jdonovan debe agregar otra columna para el escenario y luego debe ser fácil

Stage =
SWITCH ( Table[Old Value],
"Prospecting", "Stage 1",
"Qualifying", "State 2",
"Estimating", "Stage 3",
"Proposing", "Stage 4",
"Stage 5"
)

y utilizar esta nueva columna en columnas en la matriz visual

Me gustaría elogiossi mi solución me ayudó.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para darle a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

No estoy seguro de que funcionaría debido a nuestra falta de restricción. Desafortunadamente, nuestro equipo de Salesforce no ha bloqueado las posiciones iniciales, al menos no hasta hace poco. Así que un vendedor podría entrar en una oportunidad en la etapa de estimación y que técnicamente sería la Etapa 1. Y luego de allí se mueve a Proponer (o donde sea) que sería la Etapa 2 para esa oportunidad.

Extraño, lo sé.

@jdonovan Supongo que entonces usted necesita clasificar el estado y luego basado en el rango, establecer el escenario

leer más sobre la clasificación aquí.

https://radacad.com/how-to-use-rankx-in-dax-part-1-of-3-calculated-columns
https://radacad.com/how-to-use-rankx-in-dax-part-2-of-3-calculated-measures
https://radacad.com/how-to-use-rankx-in-dax-part-3-of-3-the-finale



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k Hice un breve disparo usando Rank.EQ, pero no RankX. Lo intentaré con RankX y ver si funciona.

Cuando intenté aplanar las etapas usando instrucciones if que hacen referencia a los resultados de Rank.EQ, creó una fila separada en Stage3 (creo que debido a los criterios)... verá cómo va esto.

De cualquier manera, ¡aprecio todas las sugerencias!

Gracias

John

@parry2k así que tengo el rango abajo, pero ahora produciendo las columnas para que se muestren en una fila singular parece ser un problema. Estoy usando una declaración IF para agarrar cada etapa y el rango se basa en la fecha en que la etapa cambió:

Stage1 - if( [StageRank] á 1, [OldValue])

Stage2 - if( [StageRank] á 1, [NewValue])

Stage3 - if( [StageRank] á 2, [OldValue])

Esto da como resultado lo siguiente

OppIDrangoEtapa 1Etapa 2Etapa 3
ABC1231ProspecciónCalificación
ABC1232 Estimar

Incluso cuando elimino el campo de clasificación del objeto visual de la tabla, todavía se muestra como el anterior. ¿Alguna idea de cómo conseguir todo en la misma fila? ¿Debo usar algo además de una declaración IF?

¡Gracias!

@jdonovan hmmm, creo que deberías ser un cálculo para etiquetar Etapa 1 o 2 o 3..., es como categoría con la etapa 1, 2, 3 valores en ella basado en su rango



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.