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.
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:
Fecha | Hora | Teléfono | Duración (minutos) | Pago | Cliente |
01/01/2020 | 6:00 am | 222 | 60 | 10 | A |
01/01/2020 | 1:00 pm | 222 | 45 | 15 | B |
02/01/2020 | 3:00 pm | 221 | 140 | 60 | C |
02/01/2020 | 4:00 pm | 223 | 200 | 70 | A |
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.
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:
y aquí está el archivo pbix de muestra, por favor pruébelo.
saludos
Lin
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 | |
2 | |
2 | |
2 | |
1 |