Forum Discussion
Syndicate_Admin
Administrator
1 year agoAchieve a KPI with correct values for current and target
Good days to all I'm trying to visualize a KPI with current values (previous week) and the target the same week of the previous year (-51 weeks) For the objective everything is perfect, because it...
- 1 year ago
Hi Syndicate_Admin ,
Please try the following Sales Total for the Previous Week DAX measure:
v_Ventas_Valor_SemanaAnteriorTotal = VAR FechaHoy = TODAY() VAR DiaSemanaHoy = WEEKDAY(FechaHoy, 2) -- Monday = 1, Sunday = 7 VAR FechaInicioSemanaAnterior = FechaHoy - DiaSemanaHoy - 6 -- Start of last week VAR FechaFinSemanaAnterior = FechaInicioSemanaAnterior + 6 -- End of last week RETURN CALCULATE( SUM(EncargosAnx[importe]), EncargosAnx[fecha] >= FechaInicioSemanaAnterior && EncargosAnx[fecha] <= FechaFinSemanaAnterior )Sales Total for the Same Week Last Year
v_Ventas_Valor_AnioPasado_SemanaAnterior = VAR FechaHoy = TODAY() VAR DiaSemanaHoy = WEEKDAY(FechaHoy, 2) -- Monday = 1, Sunday = 7 VAR FechaInicioSemanaAnterior = FechaHoy - DiaSemanaHoy - 6 -- Start of last week VAR FechaInicioSemanaAnioAnterior = FechaInicioSemanaAnterior - 365 -- Start of same week last year VAR FechaFinSemanaAnioAnterior = FechaInicioSemanaAnioAnterior + 6 -- End of same week last year RETURN CALCULATE( SUM(EncargosAnx[importe]), EncargosAnx[fecha] >= FechaInicioSemanaAnioAnterior && EncargosAnx[fecha] <= FechaFinSemanaAnioAnterior )If the logic still doesn’t work as expected, please let me know.
Syndicate_Admin
Administrator
1 year agoThank you very much for the answer.
Everything works perfectly
Bibiano_Geraldo
Super User
1 year ago