Forum Discussion

AntonioPed's avatar
AntonioPed
Frequent Visitor
3 years ago
Solved

Calcular Previsión Anual

Hola, soy nuevo en DAX. Estoy pasando un qlikview a Power BI y quisiera por favor saber como traducir la previsión anual desde qlikview a powerbi.

(rangesum(above(Sum ({<[Año Venta]={$(=max([AñoVenta]))}>} [Importe Venta]),0, [Mes Venta]))+rangesum(top(Sum({<[Año Venta]={$(=max([AñoVenta])-1)}>} [Importe Venta]),1, 12-[Mes Venta]))

 

La primera expresión va de Enero a Diciembre y la segunda expresión va de Diciembre a Enero

 

Enero+Diciembre

Febrero+Noviembre

Marzo+Octubre

....

Muchas gracias y saludos

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi AntonioPed ,

     

    Here I create a sample to have a test.

    Calculated column:

    Accumulate Value = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[MonthNumber]<=EARLIER('Table'[MonthNumber])))
    Accumulate Value-1 = CALCULATE(SUM('Table'[Value-1]),FILTER('Table','Table'[MonthNumber]>=EARLIER('Table'[MonthNumber])))
    Projection = 'Table'[Accumulate Value] + 'Table'[Accumulate Value-1]

     Result is as below.

     

    Best Regards,
    Rico Zhou

     

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

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi AntonioPed ,

     

    If you need help in converting qlikview script to dax, please show us a screenshot with the tables you use and the result you want. Then we can help you based on your requirement. Or you can share a sample file with us.This will make us easier to find the solution.

     

    Best Regards,
    Rico Zhou

     

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

    • AntonioPed's avatar
      AntonioPed
      Frequent Visitor

       Hola, buenos días. Aquí una captura de la tabla en formato excel. Gracias y saludos

      Spoiler

       

      • Anonymous's avatar
        Anonymous
        Not applicable

        Hi AntonioPed ,

         

        Here I create a sample to have a test.

        Calculated column:

        Accumulate Value = CALCULATE(SUM('Table'[Value]),FILTER('Table','Table'[MonthNumber]<=EARLIER('Table'[MonthNumber])))
        Accumulate Value-1 = CALCULATE(SUM('Table'[Value-1]),FILTER('Table','Table'[MonthNumber]>=EARLIER('Table'[MonthNumber])))
        Projection = 'Table'[Accumulate Value] + 'Table'[Accumulate Value-1]

         Result is as below.

         

        Best Regards,
        Rico Zhou

         

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

  • AntonioPed's avatar
    AntonioPed
    Frequent Visitor

    Muchas gracias, ya funciona. 😀 He sustituido EARLIER por MAX ya que no me funcionaba con EARLIER.

    Thank you !!! 😍