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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Anonymous
Not applicable

Apertura y cierre de saldo por categoría

Hola a todos

He adjuntado el archivo pbix:

https://www.dropbox.com/s/g9el2fm4o637gl2/Open%20%26%20Closeing%20Balance.pbix?dl=0

Tengo datos como abajo de la tabla. Mediante el uso de esta tabla quiero crear "Apertura y cierre de saldo". La salida esperada se mostró en la captura de pantalla siguiente

Screenshot_16.png

escenario 1 : Si no seleccioné ningún valor de fecha en Filtro de fecha, entonces la salida es

Screenshot_13.png

escenario 2 : Si el filtro Fecha es de 02/27/2020 a 03/31/20202 Entonces la salida es:

Nota: El saldo de apertura para las ventas de productos es suma (saldo de apertura) donde la fecha es 02/27/2020. Debido a que la fecha mínima de ventas de productos es 02/27/2020, por lo que -175584.24+0 -175584.24

Screenshot_14.png

2 ACCEPTED SOLUTIONS
tex628
Community Champion
Community Champion

No tengo ningún archivo de trabajo 🙂

Pruébalo, si estoy pensando en esto correctamente esto debería devolver los totales que estás buscando:

Opening Balance = 
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MIN(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return 
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] < P_Date)
Closing Balance = 
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MAX(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return 
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] <= P_Date)


¡Avísame cómo va!

/ J


Connect on LinkedIn

View solution in original post

tex628
Community Champion
Community Champion

Hay algunas maneras diferentes y el trabajo depende de la estructura de la matriz. Pero vamos a probar el más fácil primero, añadiendo un "+0".

Opening Balance = 
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MIN(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return 
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] < P_Date) + 0


Avísame si funciona.

/ J


Connect on LinkedIn

View solution in original post

7 REPLIES 7
tex628
Community Champion
Community Champion

Prueba esto,

Opening Balance = 
VAR P_date = SELECTEDVALUE(Table[Posting Date]) 
Return 
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] < P_Date)
Closing Balance = 
VAR P_date = SELECTEDVALUE(Table[Posting Date]) 
Return 
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] <= P_Date)


Avísame cómo va.

/ J


Connect on LinkedIn
Anonymous
Not applicable

@tex628 , Gracias por la respuesta,


Todas las cosas se ven bien.. Excepto el valor total..


He creado Calendario Maestro y conectado con Fecha de registro. Se ha añadido la fecha del calendario en el filtro y la tabla.

¿Puede compartir el archivo de trabajo.

vengadeshpalani_0-1597131916433.png

tex628
Community Champion
Community Champion

No tengo ningún archivo de trabajo 🙂

Pruébalo, si estoy pensando en esto correctamente esto debería devolver los totales que estás buscando:

Opening Balance = 
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MIN(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return 
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] < P_Date)
Closing Balance = 
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MAX(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return 
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] <= P_Date)


¡Avísame cómo va!

/ J


Connect on LinkedIn
Anonymous
Not applicable

Gracias @tex628 .. Su trabajo...

Tengo lo que quiero. Muchas gracias

una solicitud más.. ¿cómo puedo reemplazar el valor en blanco por cero

vengadeshpalani_1-1597135434209.png

tex628
Community Champion
Community Champion

Hay algunas maneras diferentes y el trabajo depende de la estructura de la matriz. Pero vamos a probar el más fácil primero, añadiendo un "+0".

Opening Balance = 
VAR P_date = IF(SELECTEDVALUE(Table[Posting Date]) = BLANK() , MIN(Table[Posting Date]) , SELECTEDVALUE(Table[Posting Date]))
Return 
CALCULATE(SUM(Table[Amount]) , ALLSELECTED(Calendar[Date]) , Calendar[Date] < P_Date) + 0


Avísame si funciona.

/ J


Connect on LinkedIn
amitchandak
Super User
Super User

@vengadeshpalani, no muy claro. es el balance de A yendo a C.

¿Puede compartir datos de ejemplo y salida de ejemplo en formato de tabla?

refer :cierrebalancemonth ,closingbalancequarter, closingbalanceyear

https://www.youtube.com/watch?v=yPQ9UV37LOU

firstnonblankvalue y lastnonblankvalue

https://www.linkedin.com/pulse/five-recent-power-bi-functions-you-should-use-more-often-amit-chandak

Full Power BI Video 20 Hours YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

si selecciono Rango de fechas de 02/27/2020 Luego

Ventas-Un saldo de apertura para 02/27/2020 es -175583.24.... 03/03/2020 el saldo de apertura es -175583.24 + (-5950.00) -181534.24 etc...

El saldo de apertura de ventas B para 02/27/2020 es 0

El saldo de apertura ventas-C para 03/09/2020 es 0

El saldo de apertura ventas-D para 03/24/2020 es 0..... 03/30/2020 el saldo de apertura es -62874

Sales-A, Sales-B, Sales-C, Sales-D se atienden bajo Ventas de Productos... por lo que la fecha mínima de venta del producto es 02/27/2020..

El saldo de apertura de ventas de productos es la suma del saldo de apertura donde la fecha es 02/27/2020

Screenshot_18.png

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors