Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago
Solved

Total value Measure

Good morning,

 

I need to calculate some values based on the total value of a measure and the final value is not getting me right. I have seen that it is a problem that happens to a lot of people but I am not able to come up with a solution. Can you help me, please?

 

 

The sum is 8820 and I need 5796.

 

Formula:

Activity data = [Stock Final Last Month] + [Entradas] - [Stock Final]

 

Is based on other measures:

 

Entradas =
CALCULATE(
sum(Movimentos[Quant.]),
FILTER(TipoMov,TipoMov[Descrição Movimento]="Recepção compra"),
FILTER(Cod_Artigo,Cod_Artigo[Cod_Artigo]="60700400")
)
 
Stock Final =
CALCULATE(
sum(StockFinal[Stock Final]),
PREVIOUSMONTH(DATA[Date]),
FILTER(Cod_Artigo,Cod_Artigo[Cod_Artigo]="60700400")
)
 
Stock Final Last Month =
CALCULATE(
sum(StockFinal[Stock Final]),
DATEADD(DATA[Date],-2,MONTH),
FILTER(Cod_Artigo,Cod_Artigo[Cod_Artigo]="60700400")
)

 

Thanks
  • Anonymous , Try a measure like

    Activity data = sumx(Values(Date[Month]), [Stock Final Last Month] + [Entradas] - [Stock Final])

     

    or

     

    Activity data = sumx(Values(Date[Month Year]), [Stock Final Last Month] + [Entradas] - [Stock Final])

2 Replies

  • Anonymous , Try a measure like

    Activity data = sumx(Values(Date[Month]), [Stock Final Last Month] + [Entradas] - [Stock Final])

     

    or

     

    Activity data = sumx(Values(Date[Month Year]), [Stock Final Last Month] + [Entradas] - [Stock Final])

  • Anonymous's avatar
    Anonymous
    Not applicable
    Hello again,
     
    My PowerBI works but is very slow. So I decided to improve DAX. I apply the same formula but it doesn't work, why?
     
     
     
    New =
    Var CodArtigo = FILTER(Cod_Artigo,Cod_Artigo[Cod_Artigo]="60700410")

     

    Var AceGarrEnt =
    CALCULATE(
    sum(Movimentos[Quant.]),
    FILTER(TipoMov,TipoMov[Descrição Movimento]="Recepção compra"),CodArtigo)

     

    Var AceGarrStockFinal =
    CALCULATE(
    sum(StockFinal[Stock Final]),PREVIOUSMONTH(DATA[Date]),CodArtigo)
     
    var AceGarrSFinalLMonth =
    CALCULATE(
    sum(StockFinal[Stock Final]),
    DATEADD(DATA[Date],-2,MONTH),CodArtigo)

     

    var AceGarrSFinalLMonth2 =
    IF(AceGarrStockFinal=BLANK(),BLANK(),AceGarrSFinalLMonth)

     

    var AceGarrDAct = SUMX(VALUES(DATA[Month]), AceGarrSFinalLMonth2 + AceGarrEnt - AceGarrStockFinal)

     

    return

     

    AceGarrDAct
     
    Thanks