Forum Discussion

aamira's avatar
aamira
Frequent Visitor
6 years ago
Solved

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.

 

 

 

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!

 

  • 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:

     

    and here is sample pbix file, please try it.

     

    Regards,

    Lin

5 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Icon for Community Champion rankCommunity Champion

    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

    • aamira's avatar
      aamira
      Frequent Visitor

      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.