Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
He estado buscando esto sin cesar en vano.
Tengo la siguiente tabla (no se puede analizar el resultado en Power Query porque es una columna calculada):
resultado | itemsNum | totalImporte |
"id":"301","amount":"10"|" id":"764","cantidad":"15" | 2 | |
"id":"455","amount":"25"|" id":"908","cantidad":"75"|" id":"321","cantidad":"55"|" id":"877","cantidad":"75"|" id":"989","cantidad":"60" | 5 | |
"id":"112","amount":"65"|" id":"115","cantidad":"90"|" id":"119","cantidad":"80" | 3 | |
"id":"612","amount":"70"|" id":"729","cantidad":"25"|" id":"854","cantidad":"15"|" id":"098","cantidad":"25"|" id":"075","cantidad":"30"|" id":"181","cantidad":"30"|" id":"193","cantidad":"35"|" id":"303","cantidad":"40" | 8 |
El formulario de cadena de resultado es "id":"[id_value]","amount":"[amount_value]"|" id":"[id_value]","cantidad":"[amount_value]"|...
¿Cuál debería ser la fórmula de columna amountTotal si quiero sumar cada cantidad de elemento de fila individual?
Funciona perfectamente, ¡muchas gracias!
@poweringthru Probar:
totalAmount =
VAR __Path = [result]
VAR __Table0 =
ADDCOLUMNS(
GENERATESERIES( 1, [itemsNum], 1 ),
"__Item", PATHITEM( __Path, [Value] )
)
VAR __Table1 =
ADDCOLUMNS(
__Table0,
"__SubPath", SUBSTITUTE( [__Item], """,""", "|" )
)
VAR __Table2 =
ADDCOLUMNS(
__Table1,
"__SubItem", PATHITEM( [__SubPath], 2 )
)
VAR __Table3 =
ADDCOLUMNS(
__Table2,
"__Value", SUBSTITUTE( SUBSTITUTE( [__SubItem], "amount"":""", "" ), """", "" ) + 0
)
VAR __Result = SUMX( __Table3, [__Value] )
RETURN
__Result
Humildemente pido perdón a los dioses del DAX...
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |
User | Count |
---|---|
2 | |
2 | |
2 | |
2 | |
1 |