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.
Hola a todos,
Tengo una situación en la que tengo que calcular la suma por subcategoría + (suma de categoría / recuento de subcategoría)
en la tabla Subestación representan el costo de la Categoría
Mesa:
Categoría | Subcategoría | Costo |
Ardmore | Ardmore 24 | $1,653,166 |
Bellcow | Bellcow 21 | $1,582,508 |
Bellcow | Bellcow 50 | $1,390,279 |
Bellcow | Subestación | $359,641 |
Belle Isle Sta | Belle Isle Sta 22 | $679,518 |
Belle Isle Sta | Belle Isle Sta 26 | $1,029,278 |
Belle Isle Sta | Belle Isle Sta 28 | $732,765 |
Belle Isle Sta | Subestación | $741,009 |
Bixby | Bixby 22 | $920,072 |
Bixby | Bixby 29 | $1,780,361 |
Bixby | Subestación | $1,192,041 |
Calcinación que necesitábamos
ejemplo: para la Subcategoría Ardmore 24 no hay categoría por lo que
Gasto total: $1,653,166
Para la Categoría Bellcow tenemos 2 subcategorías, por lo que el Gasto Total debe ser
ahora vamos a tomar subcategoría Bellcow 21 que una categoría Bellcow como subestación por lo que necesitamos
Gasto total : Subcategoría+Categoría/Recuento de subcategoría ($1,582,508+($359,641/2) - $1,762,329)
ahora vamos a tomar subcategoría Bellcow 50 que una categoría Bellcow como subestación por lo que necesitamos
Gasto total : Subcategoría+Categoría/Recuento de subcategoría ($1,390,279+($359,641/2) - $1,730,038)
Ahora para Belle Isle Sta Categoría tenemos 3 subcategorías por lo que el Gasto Total debe ser
ahora vamos a tomar Subcategory Belle Isle Sta 22 que una categoría Bellcow como subestación por lo que necesitamos
Gasto total: Subcategoría+Categoría/Recuento de subcategoría ($679,518+($741,009/3) - $926,521)
Categoría | Subcategoría | Costo | Gasto total |
Ardmore | Ardmore 24 | $1,653,166 | $1,653,166 |
Bellcow | Bellcow 21 | $1,582,508 | $1,762,329 |
Bellcow | Bellcow 50 | $1,390,279 | $1,730,038 |
Bellcow | Subestación | $359,641 | $359,641 |
Belle Isle Sta | Belle Isle Sta 22 | $679,518 | $926,521 |
Belle Isle Sta | Belle Isle Sta 26 | $1,029,278 | $1,335,969 |
Belle Isle Sta | Belle Isle Sta 28 | $732,765 | $1,326,219 |
Belle Isle Sta | Subestación | $741,009 | $741,009 |
Bixby | Bixby 22 | $920,072 | $1,516,092.50 |
Bixby | Bixby 29 | $1,780,361 | $1,780,361.00 |
Bixby | Subestación | $1,192,041 | $1,192,041 |
Solved! Go to Solution.
@rasala583 probar esta medida
Measure 2 =
VAR __count =
CALCULATE (
COUNTROWS ( 'Table (2)' ),
ALLEXCEPT ( 'Table (2)', 'Table (2)'[category] ),
'Table (2)'[subcategory] <> "Substation"
)
VAR __substation =
CALCULATE (
SUM ( 'Table (2)'[Cost ] ),
ALLEXCEPT ( 'Table (2)', 'Table (2)'[category] ),
KEEPFILTERS ( 'Table (2)'[subcategory] = "Substation" )
)
RETURN
//DIVIDE (
SUM ( 'Table (2)'[Cost ] )
+ DIVIDE (
__substation,
IF ( MAX ( 'Table (2)'[subcategory] ) = "Substation", 0, __count )
)
Puede ajustarlo según sus necesidades, pero le ayudará a empezar.
Me gustaría❤ elogiossi mi solución ayudara.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para dar a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!
⚡Visítenos enhttps://perytus.com, su ventanilla única para proyectos/formación/consulta relacionadas con Power BI.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
@rasala583 - No del todo claro aquí, pero parece que esto podría ayudar:
@rasala583, no muy claro. Pero parece que necesitas usar allexcept
https://www.sqlbi.com/articles/using-allexcept-versus-all-and-values/
https://community.powerbi.com/t5/Desktop/Percentage-of-subtotal/td-p/95390
@rasala583 probar esta medida
Measure 2 =
VAR __count =
CALCULATE (
COUNTROWS ( 'Table (2)' ),
ALLEXCEPT ( 'Table (2)', 'Table (2)'[category] ),
'Table (2)'[subcategory] <> "Substation"
)
VAR __substation =
CALCULATE (
SUM ( 'Table (2)'[Cost ] ),
ALLEXCEPT ( 'Table (2)', 'Table (2)'[category] ),
KEEPFILTERS ( 'Table (2)'[subcategory] = "Substation" )
)
RETURN
//DIVIDE (
SUM ( 'Table (2)'[Cost ] )
+ DIVIDE (
__substation,
IF ( MAX ( 'Table (2)'[subcategory] ) = "Substation", 0, __count )
)
Puede ajustarlo según sus necesidades, pero le ayudará a empezar.
Me gustaría❤ elogiossi mi solución ayudara.👉Si puedes pasar tiempo publicando la pregunta, también puedes hacer esfuerzos para dar a Kudos quien haya ayudado a resolver tu problema. ¡Es una muestra de agradecimiento!
⚡Visítenos enhttps://perytus.com, su ventanilla única para proyectos/formación/consulta relacionadas con Power BI.⚡
Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!
Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo
If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤
Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.
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 |