Forum Discussion

MadhuKumar's avatar
MadhuKumar
Helper II
1 year ago
Solved

Cumilative total

I want to calculate cumilative total for each report date, meter name wise by using bbls_previous_meter reading as  a source column.  I have tried below dax formulas but the calculation was showing not correct. Can you please provide dax that should give accurate results.

1)

**bleep** Total = var _Metername = MAX('LTS Data'[name])
VAR _Date= MAX('LTS Data'[Capture_date])
VAR _table= FILTER(ALLSELECTED('LTS Data'),'LTS Data'[name]=_Metername && 'LTS Data'[Capture_date]]<=_Date)
VAR _Result=SUMX(_table,'LTS Data'[bbls_since_previous_reading])
RETURN _Result
 
2)
Cumulative total =
VAR CurrentDateTime = 'Mastermeter Report'[Capture Date]
VAR CurrentMeter = 'Mastermeter Report'[name]
RETURN
CALCULATE(
   SUM('Mastermeter Report'[bbls_since_previous_reading]),
   FILTER(
       ALL('Mastermeter Report'),
       'Mastermeter Report'[Capture Date] <= CurrentDateTime &&
       'Mastermeter Report'[name] = CurrentMeter
   )
)
 
Sample Data pic:
  • Anonymous's avatar
    Anonymous
    1 year ago

    Hi MadhuKumar ,
    Does Angith_Nair  answer solve your problem, if yes, you can mark his reply as a solution, if not, you can post your question.

     

    Best regards,
    Albert He

2 Replies

  • Angith_Nair's avatar
    Angith_Nair
    Continued Contributor

    Hi MadhuKumar 

     

    Try the below DAX:

    Cumulative Total =
    VAR CurrentMeter = MAX('LTS Data'[name])
    VAR CurrentDate = MAX('LTS Data'[Capture_date])
    RETURN
        CALCULATE(
            SUM('LTS Data'[bbls_since_previous_reading]),
            FILTER(
                ALL('LTS Data'),
                'LTS Data'[name] = CurrentMeter &&
                'LTS Data'[Capture_date] <= CurrentDate
            )
        )
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi MadhuKumar ,
    Does Angith_Nair  answer solve your problem, if yes, you can mark his reply as a solution, if not, you can post your question.

     

    Best regards,
    Albert He