Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
turcelaygoy
Helper I
Helper I

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:

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 CurrentFaults =
SUMX ( FILTER ( T, Hoja1[ORDEN COCHE PROYECTO]= [Value] ), Hoja1[FALTAS TOTALES (QA)] )
VAR NextFaults =
SUMX ( FILTER ( T, Hoja1[ORDEN COCHE PROYECTO]= [Value] + 1 ), Hoja1[FALTAS TOTALES (QA)] )
RETURN
DIVIDE ( NextFaults - CurrentFaults, CurrentFaults ) * 100
)
)
1 REPLY 1
turcelaygoy
Helper I
Helper 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. 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.