Monday, January 23, 2023

DAX - Calculo de tempo , age, idade

 .Age = INT ( YEARFRAC ( [birthday].[Date], TODAY (), 1 ) )

===================================================================

 .Age = INT ( YEARFRAC ( [birthday].[Date], TODAY (), 1 ) )

===================================================================

.V_Dt_Encerramento =
if(TRIM([/BIC/ZDTENCERR]) = "" , "ERR Enc Null",
if(TRIM([/BIC/ZDTABER]) = "" , "Err Abt Null",
if([/BIC/ZDTENCERR] = "00000000", "ERR Enc ZERO",
if(AND(MID([/BIC/ZDTENCERR],"1","4") = "9999",MID([/BIC/ZDTABER],"1","4") = "9999"), "Err - Dup Abt & Fec",
if(AND(MID([/BIC/ZDTENCERR],"1","4") = "9999",MID([/BIC/ZDTABER],"1","4") <> "9999"), "OK - Aberto",
if(NOT OR(MID([/BIC/ZDTENCERR],"1","1") = "1",
          MID([/BIC/ZDTENCERR],"1","1") = "2"), "ERR DT",
"OK - Fechado"))))))
.qtdAnosP =
var dtA_year = INT(MID([/BIC/ZDTABER],"1","4"))
var dtA_month = INT(MID([/BIC/ZDTABER],"5","2"))
var dtA_day = (MID([/BIC/ZDTABER],"7","2"))
var dtA = DATE( (dtA_year) ,   (dtA_month) ,   (dtA_day))
RETURN
IF(DIM_SAP_Postos_New[.V_Dt_Encerramento] = "OK - Aberto",INT ( YEARFRAC ( dtA, TODAY (), 1 ) ))

Power BI APP - Delete or Unpublish

 UNPUBLISH DELETE