Forum Discussion

Bokazoit's avatar
Bokazoit
Icon for Post Prodigy rankPost Prodigy
5 years ago
Solved

Accumulated amount only up til current date

I need to show the amount in finance up til current date. But at the same time I need to show budgets accumulated until end of year.

 

I use this measure:

 

Amount (Accumulated) =

VAR MaxAar = MAX(DimDato[År])
VAR MaxDato = MAX(DimDato[Dato])

RETURN
CALCULATE(
SUM(FactFinans[#Bogførtbeløb]),
FILTER(
ALL(DimDato),
DimDato[År] = MaxAar
&& DimDato[Dato] <= MaxDato
))
 
But also need to show the current budget/estimate for full year:
 
Nuværende estimat (Akkumuleret) = CALCULATE(
[current estimate],
FILTER(
ALL(DimDato),
DimDato[År] = MAX(DimDato[År])
&& DimDato[Dato] <= MAX(DimDato[Dato])
)
)
 
Can that be done?
 
Any help is greatly appreciated
  • This solved it:

    Bogført beløb (Akk. Dags dato) = 
    
    VAR __MaxYT = MAX(DimDato[År])
    var __MaxDT = max(DimDato[Dato])
    var __TD = TODAY()
    var __Rtotal = 
      CALCULATE([Bogført beløb],
        Filter(
            All(DimDato), 
                DimDato[År] = __MaxYT
                    && DimDato[Dato] <= __MaxDT)
    )
    
    RETURN
    IF (__MaxDT >= EOMONTH(__TD,1), BLANK(), __Rtotal)

2 Replies