Forum Discussion
How to Compare two date fields?
- 8 years ago
Anonymous
Hi, instead of using a calculated column you need to use a measure
D2 = IF ( MIN ( 'Registro Diario'[Fecha] ) = [Prueba]; 0; 1 )
Regards
Victor
Hi Anonymous,
can you share a sample of the PBIX file?
Regards,
MFelix
- Vvelarde8 years agoCommunity Champion
Anonymous
Hi, instead of using a calculated column you need to use a measure
D2 = IF ( MIN ( 'Registro Diario'[Fecha] ) = [Prueba]; 0; 1 )
Regards
Victor
- MFelix8 years agoSuper User
Hi Anonymous,
Looking at your PBIX file this as to be change to a measure as I refered in my first post and as Vvelarde also indicates in his response, if you do that it will give you 0 for the first record and 1 for all the others
Regards,
MFelix
- Anonymous8 years agoNot applicable
I apologize because I said something wrong, in fact the distance field that I have as a column is because I need to perform the following calculation
Distancia (KM)= var Lat1='Registro Diario'[Latitud - Distancia] * 3,1415 / 180
var Lat2 = 'Registro Diario'[Latitud - Distancia.Anterior] * 3,1415 / 180
var Lon1 = 'Registro Diario'[Longitud - Distancia] * 3,1415 / 180
var Lon2 = 'Registro Diario'[Longitud - Distancia.Anterior] * 3,1415 / 180
var valor = Cos( Lat1 ) * Cos( Lat2 ) * Cos( Lon2 - Lon1 ) + Sin( Lat1 ) * Sin( Lat2 )
return IF(valor<0,99999999999999999999;IF('Registro Diario'[Fecha]=CALCULATE ( MIN ( 'Registro Diario'[Fecha] ); ALLSELECTED ( 'Registro Diario' ) );0;6378*ACOS(valor));0)When I try to pass it as a measure this columns weren't recognized
'Registro Diario'[Longitud - Distancia.Anterior]
'Registro Diario'[Longitud - Distancia]
'Registro Diario'[Latitud - Distancia.Anterior]
'Registro Diario'[Latitud - Distancia]
I apologize for the lack of information
- MFelix8 years agoSuper User
Hi Anonymous,
Try to use a MAX or MIN function on those columns to make context on them.
Regards,
MFelix