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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
RicardoLeivaG
Helper I
Helper I

Calculo de medidas para obtener metas

Hola comunidad:

 

Tengo el siguiente problema tengo un tabla (idh_hist20062020) que tiene el valor de las facturas en distintos periodos de tiempo 

ejemplo

BillInvoiceAmontDateKey
2222123455698631-02-2021febrero2021
2221222225687902-01-2020enero2020
256325256589222548831-01-2021enero2021

 

tambien tengo una tabla con las metas de este año, 

mesañoporcentajeKeymeta
enero20214%enero2021
febrero202110%febrero2021

 

las metas son el aumento de venta del año anterior, para calcular el monto acumulado del año anterior tengo la siguiente medida

 

Venta PR Anterior = IF(
    ISFILTERED(idh_hist20062020[date]),ERROR("Error1"),
VAR __PREV_YEAR2 =
        CALCULATE(
            SUM(idh_hist20062020[amount]),
DATEADD(idh_hist20062020[date].[Date], -1,YEAR)
)
RETURN __PREV_YEAR2
)
 
Lo que necesito es que cuando sea enero del 2021 multiplique el perioro por la meta
 
AñoMes MontoMonto periodo anteriorMetaMeta a alcanzar
2021enero22254882568794%(Monto periodo anterior) * (meta)

 

 

alguna idea las tablas estan relacionadas por el campo key

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi @RicardoLeivaG 

  

You could create measures by the following formula: 

Monto periodo anterior =
VAR _date =
    EOMONTH ( MAX ( [Date] ), -12 )
RETURN
    CALCULATE (
        SUM ( idh_hist20062020[Monto] ),
        FILTER ( ALL ( 'idh_hist20062020' ), EOMONTH ( [Date], 0 ) = _date )
    )
Meta a alcanzar =[Monto periodo anterior]*MAX('Table'[porcentaje])

The final output is shown below:  

 

v-yalanwu-msft_1-1622440337971.png

 

Best Regards,
Community Support Team_ Yalan Wu
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

1 REPLY 1
v-yalanwu-msft
Community Support
Community Support

Hi @RicardoLeivaG 

  

You could create measures by the following formula: 

Monto periodo anterior =
VAR _date =
    EOMONTH ( MAX ( [Date] ), -12 )
RETURN
    CALCULATE (
        SUM ( idh_hist20062020[Monto] ),
        FILTER ( ALL ( 'idh_hist20062020' ), EOMONTH ( [Date], 0 ) = _date )
    )
Meta a alcanzar =[Monto periodo anterior]*MAX('Table'[porcentaje])

The final output is shown below:  

 

v-yalanwu-msft_1-1622440337971.png

 

Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.