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

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.

Reply
aamira
Frequent Visitor

Rotación de Cartera

¡Saludos Comunidad!

 

Requiero por favor de su ayuda con el cálculo de la rotación de cartera por mes:

 

 

Los datos utilizados son las Ventas a Crédito y el Saldo Final:

 

 

Por ejemplo, miremos el caso de diciembre de 2019:

Se toma el valor del Saldo Final del mes (diciembre) 11.891 menos Ventas Crédito 5.808 del mes (diciembre), nos da un resultado de 6.083; Luego este resultado lo restamos al valor de las Ventas Crédito del mes anterior (noviembre) 5.008, nos da un resultado de 1.074, así sucesivamente hasta que el valor sea negativo. Al compararlo con las Ventas Crédito del mes anterior (octubre) 4.820 nos da un resultado negativo -3.746.

 

El último valor positivo es 1.074 este valor se debe dividir con el valor obtenido de la fórmula (Ventas Crédito/30), 30 es una representación en días, este valor es fijo; En este caso 4.820/30 = 160.670.520. Ahora bien, el siguiente cálculo es 1.074/160.670.520 = 6,69

En este orden de ideas la Rotación de Cartera para el mes de diciembre del año 2019 sería 30+30+6,69 = 66,69.

 

Total.png

 

Rotación.png

 

Anexo Excel con los cálculos

https://drive.google.com/file/d/1R5xi0_I5UTu3XBcTh-EdtTMe5Su0ekdI/view?usp=sharing 

 

PBIX:

https://drive.google.com/open?id=1IRNI5bFrIV1lAAclLcpxhL7ccopPHkAG 

 

Nota: La idea es hacer esta fórmula en una sola medida en caso de ser posible.

 

Muchas gracias!

 

1 ACCEPTED SOLUTION

hi  @aamira 

Try this way as below:

Step1:

Add  Year and Month column in Dimdate table

Step2:

Create three measure as below:

valor = 
CALCULATE(SUM(Datos[Saldo Final]),FILTER(ALL(DimDate),DimDate[Year]=MAX(DimDate[Year])&&DimDate[Month]=12))-CALCULATE(SUM(Datos[Ventas Credito]),FILTER(ALL(DimDate),DimDate[Year]=MAX(DimDate[Year])&&DimDate[Date]>=MAX(DimDate[Date])))
MonthlyPortfolio Rotation = 
var _maxmonth=CALCULATE(MAX(DimDate[Month]),FILTER(ALL(DimDate),DimDate[Year]=MAX(DimDate[Year])&&[valor]<0))
return
IF(MAX(DimDate[Month])=_maxmonth,CALCULATE([valor],FILTER(ALL(DimDate),DimDate[Year]=MAX(DimDate[Year])&&DimDate[Month]=_maxmonth+1))/DIVIDE(CALCULATE(SUM(Datos[Ventas Credito])),30),IF(MAX(DimDate[Month])>_maxmonth,30))
Result = var _table=SUMMARIZE(DimDate,DimDate[Year],DimDate[Month],"_value",[MonthlyPortfolio Rotation]) 
return
SUMX(_table,[_value])

 

Result:

8.JPG

 

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Greg_Deckler
Super User
Super User

Lo sentimos, el uso de software de traducción, así que no estoy seguro de entender completamente. ¿Quizás un problema total de medidas? Si es así, ver mi post al respecto aquí: https://community.powerbi.com/t5/DAX-Commands-and-Tips/Dealing-with-Measure-Totals/td-p/63376

Además, esta medida rápida, medida totales, la palabra final debe obtener lo que necesita:
https://community.powerbi.com/t5/Quick-Measures-Gallery/Measure-Totals-The-Final-Word/m-p/547907


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...

Greetings Community!

 

Please require your help with calculating portfolio turnover per month 
 

The data used are Credit Sales and the Final Balance 
 

For example, let's look at the case of December 2019:

The value of the Final Balance of the month is taken (December) 11,891 less Credit Sales 5,808 of the month (December), it gives us a result of 6,083; Then we subtract this result from the Credit Sales value of the previous month (November) 5,008, it gives us a result of 1,074, so on until the value is negative. When compared to the Credit Sales of the previous month (October) 4,820 gives us a negative result -3,746.

 

The last positive value is 1,074, this value must be divided with the value obtained from the formula (Credit Sales / 30), 30 is a representation in days, this value is fixed; In this case 4,820 / 30 = 160,670,520. Now the next calculation is 1,074 / 160,670,520 = 6.69

In this order of ideas, the Portfolio Rotation for the month of December 2019 would be 30 + 30 + 6.69 = 66.69.

hi  @aamira 

Could you please share your sample pbix file for us have a test? that will be a great help.

Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

hi  @aamira 

Try this way as below:

Step1:

Add  Year and Month column in Dimdate table

Step2:

Create three measure as below:

valor = 
CALCULATE(SUM(Datos[Saldo Final]),FILTER(ALL(DimDate),DimDate[Year]=MAX(DimDate[Year])&&DimDate[Month]=12))-CALCULATE(SUM(Datos[Ventas Credito]),FILTER(ALL(DimDate),DimDate[Year]=MAX(DimDate[Year])&&DimDate[Date]>=MAX(DimDate[Date])))
MonthlyPortfolio Rotation = 
var _maxmonth=CALCULATE(MAX(DimDate[Month]),FILTER(ALL(DimDate),DimDate[Year]=MAX(DimDate[Year])&&[valor]<0))
return
IF(MAX(DimDate[Month])=_maxmonth,CALCULATE([valor],FILTER(ALL(DimDate),DimDate[Year]=MAX(DimDate[Year])&&DimDate[Month]=_maxmonth+1))/DIVIDE(CALCULATE(SUM(Datos[Ventas Credito])),30),IF(MAX(DimDate[Month])>_maxmonth,30))
Result = var _table=SUMMARIZE(DimDate,DimDate[Year],DimDate[Month],"_value",[MonthlyPortfolio Rotation]) 
return
SUMX(_table,[_value])

 

Result:

8.JPG

 

and here is sample pbix file, please try it.

 

Regards,

Lin

Community Support Team _ Lin
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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