Forum Discussion
Incorrect total in measures
Hello everyone,
I'm having the following issue:
I have this measure
Total Valor Final =
VAR IDVistaDetalle = SELECTEDVALUE(TTipoCuenta[Vista Detalle])
VAR IDDetalle = SELECTEDVALUE(TTipoCuenta[Detalle])
VAR IDDetalleVisible = ISFILTERED(TCuentas[SubGrupo])
VAR Resultado = SWITCH(TRUE(),IDDetalleVisible=TRUE() && IDDetalle = 0, BLANK(),
IDVistaDetalle = 1, [Total Valor Previo],
IDVistaDetalle = 2, [Valor Acumulado])
RETURN
Resultado
this works properly. But i'm trying to normalize this values with laboral day's between years.
To this I have created the following column in my date table
Laboral Day =
VAR EsFinDeSemana = Dates[Number Day] IN {7}
VAR EsFestivo =
RELATED(TablaFestivos[Fecha])
RETURN
IF (EsFestivo || EsFinDeSemana,0,1)
It works fine.
After that, I'm using the follow measure to calculate the values adjusted by year
AdjustYear = var total =CALCULATE([Total Valor Final], SAMEPERIODLASTYEAR(Dates[Date]))
var LBCY= CALCULATE(SUMX(Dates,Dates[Laboral Day]))
var PYLB= CALCULATE(SUMX(Dates,Dates[Laboral Day]),SAMEPERIODLASTYEAR(Dates[Date]))
return - DIVIDE(total, PYLB)*LBCY
But when I do it my totals are wrong only in adjusted year....values by row are correct and total values in 2021 and 2022 are correct.
This is a sample:
as you can see when, it is taking the same total for two columns but values are different in rows.....
Any help?
1 Reply
- AnonymousNot applicable
Hi Anonymous
It may be effected by your Dates[Number Day], did you use the weekday() function, if you use it, what is the retuen type(the bold character bellow) of your weekday?
WEEKDAY('Table 3'[Date],2)You can refer to the following links:Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.