Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
Hello!
I was trying to calculate the variation of some faults in the different units of products and I have been able to see the variation between to independent units of products. I was wondering if there is any way of programing loops so I can run the database and see the acumulated variation that is happening through those units of products.
Example:
Right now I'm able to calculate the variation between units 5 and 10 doing: (Number of faults in unit 10-Number of faults in unit 5)/Number of faults in unit 5*100
But I would like to calculate the variation taking into account all the units of products that are between 5 and 10; 5,6,7,8,9 and 10.
I hope someone can help me with this problem 🙂
Thank you!
Solved! Go to Solution.
Hi @turcelaygoy
I think now is correct.
Filtered variation_2 =
AVERAGEX (
CROSSJOIN (
CROSSJOIN ( VALUES ( 'UT_INII'[UT1] ), VALUES ( 'UT_FIN'[UT2] ) ),
VALUES ( 'Tabla Proyecto'[PROYECTO] )
),
VAR T =
CALCULATETABLE ( Hoja1 )
RETURN
AVERAGEX (
GENERATESERIES ( [UT1], [UT2] - 1, 1 ),
VAR CurrentFaults =
SUMX ( FILTER ( T, Hoja1[Columna] = [Value] ), Hoja1[FALTAS TOTALES (QA)] )
VAR NextFaults =
SUMX ( FILTER ( T, Hoja1[Columna] = [Value] + 1 ), Hoja1[FALTAS TOTALES (QA)] )
RETURN
DIVIDE ( NextFaults - CurrentFaults, CurrentFaults ) * 100
)
)
Ok. This is the measure I'm using right now to calculate the variation:
First of all I take the values of the UT from a table that lists all the possible units. Then I do the same with the project and I calculate the variation as follows:
@turcelaygoy
Assumptions:
Please try
Filtered variation =
AVERAGEX (
CROSSJOIN (
CROSSJOIN ( VALUES ( 'inicial unit'[UT] ), VALUES ( 'final unit'[UT] ) ),
VALUES ( 'Project'[PROJECT] )
),
VAR T =
CALCULATETABLE ( Sheet1 )
RETURN
AVERAGEX (
GENERATESERIES ( 'inicial unit'[UT], 'final unit'[UT] ),
VAR CurrentFaults =
SUMX ( FILTER ( T, Sheet1[UT] = [Value] ), Sheet1[TOTAL FAULTS (QA)] )
VAR NextFaults =
SUMX ( FILTER ( T, Sheet1[UT] = [Value] + 1 ), Sheet1[TOTAL FAULTS (QA)] )
RETURN
IF (
NextFaults <> BLANK (),
DIVIDE ( NextFaults - CurrentFaults, CurrentFaults ) * 100
)
)
)
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 9 | |
| 5 | |
| 5 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 24 | |
| 11 | |
| 9 | |
| 6 | |
| 6 |