Forum Discussion
Calculate permutation
Hello!
I'm trying to calculate an evolution of faults calculating the average of the variations between two not consecutive cars. But I want to do a permutation and calculate the variation of each car with all the rest. I don't know if this could be possible to do or not. I attach the code and the explanation of each variable I have so far so it can give some more informartion.
Explanation of the variables on the code:
The variable PROYECTO and AREA are chosen in the data segmentations that appear in the doccument.
PROYECTO: It's the project to which the car belongs to
AREA: Is the area we want to analyze( Examples: painting area or stuctures area)
Hoja1: The sheet with all the information
ORDEN COCHE PROYECTO: It's a variable that I have created that numbers the cars chronologically so in the generateseries I can go car by car seeing how many faults have been found on each car.
FALTAS TOTALES (QA): The number of faults that have been found in each car
Code:
1 Reply
- turcelaygoyHelper I
Quality variation_COCHE2 =
AVERAGEX (
CROSSJOIN (
VALUES ( 'Tabla Proyecto'[PROYECTO] ),VALUES('Tabla Area'[AREA]) ),
VAR T =
CALCULATETABLE ( Hoja1 )
RETURN
AVERAGEX (
GENERATESERIES ( MIN(Hoja1[ORDEN COCHE PROYECTO]), MAX(Hoja1[ORDEN COCHE PROYECTO]) -1 , 1 ),
var Z= [Value]
AVERAGEX(
GENERATESERIES ( Z , MAX(Hoja1[ORDEN COCHE PROYECTO]) - 1 , 1 ),
VAR W = [Value]
VAR CurrentFaults = SUMX ( FILTER ( T, Hoja1[ORDEN COCHE PROYECTO]= Z), Hoja1[FALTAS TOTALES (QA)] )
VAR NextFaults = SUMX ( FILTER ( T, Hoja1[ORDEN COCHE PROYECTO]= W + 1 ), Hoja1[FALTAS TOTALES (QA)] )
RETURN
DIVIDE ( NextFaults - CurrentFaults, CurrentFaults ) * 100 )
)
)I came up with this but I would like to know if there is any option of making the variables Z and W work. Right now the measure doesn't work due to those two variables.