Forum Discussion

Charli's avatar
Charli
Frequent Visitor
2 years ago
Solved

Formula to agregate data

Hello all, I am working on PBI desktop I am trying to write a formula to agregate some numbers in a precise order. To define the order, I have added a column next to my data with the correct "order...
  • Walter_W2022's avatar
    2 years ago
    Hi Charli , please try this, I assumed you want to calculate running total based on the order, it will be great if you can provide more details or data.
    Calculation = 
    VAR _MaxNum = MAX('PnL Conso (nature)'[Num order 2])
    VAR _RT =
    if(
    'Calculation'[nbre lignes]=1,
    CALCULATE(
    [In M€],
    FILTER(
    ALL('PnL Conso (nature)'),
    'PnL Conso (nature)'[Num order 2]<_MaxNum
    )
    )
    )
     
    RETURN
    _RT