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
Anonymous
Not applicable

Origen - Destino

Hola a todos. Soy nuevo en Power BI y estoy tratando de hacer algún tipo de análisis sobre el origen de un cliente y el destino. Se trata de un estacionamiento.

Este es un ejemplo:

FechaHoraTeléfonoDuración (minutos)PagoCliente
01/01/20206:00 am2226010A
01/01/20201:00 pm2224515B
02/01/20203:00 pm22114060C
02/01/20204:00 pm22320070A

Quiero por ejemplo que un usuario (teléfono) visitó el cliente A y luego visitó el cliente B, así que ¿qué hago para hacer que el cliente A sea un origen y B un destino?. ¿Es posible?


Gracias.

1 REPLY 1
v-lili6-msft
Community Support
Community Support

hola @LuisELopez

Para su caso, usted podría tratar de esta manera como se indica a continuación:

Paso 1:

Agregue una columna datetime que combine la columna de fecha y la columna de hora

Datetime = 'Table'[Date]+'Table'[Hour ]

Step2:

Para su caso, si un usuario (teléfono) que sólo tiene un registro en un día, ¿cómo se define?

Si lo quieres como origen

Sólo tiene que utilizar esta fórmula para crear una columna:

Column = 
var _firstdatetime=CALCULATE(MIN('Table'[Datetime]),FILTER('Table','Table'[Date]=EARLIER('Table'[Date])&&'Table'[Phone]=EARLIER('Table'[Phone])))
var _lastdatetime=CALCULATE(MAX('Table'[Datetime]),FILTER('Table','Table'[Date]=EARLIER('Table'[Date])&&'Table'[Phone]=EARLIER('Table'[Phone])))
return
IF('Table'[Datetime]=_firstdatetime,"origin",IF('Table'[Datetime]=_lastdatetime,"destiny"))

o si lo desea como en blanco u otro valor, sólo por esta lógica:

Column 2 = 
var _firstdatetime=CALCULATE(MIN('Table'[Datetime]),FILTER('Table','Table'[Date]=EARLIER('Table'[Date])&&'Table'[Phone]=EARLIER('Table'[Phone])))
var _lastdatetime=CALCULATE(MAX('Table'[Datetime]),FILTER('Table','Table'[Date]=EARLIER('Table'[Date])&&'Table'[Phone]=EARLIER('Table'[Phone])))
return
IF(_firstdatetime=_lastdatetime,BLANK(), IF('Table'[Datetime]=_firstdatetime,"origin",IF('Table'[Datetime]=_lastdatetime,"destiny")))

Resultado:

6.JPG

y aquí está el archivo pbix de muestra, por favor pruébelo.

saludos

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.