Forum Discussion

RafaelRSantos_'s avatar
RafaelRSantos_
Frequent Visitor
4 years ago
Solved

Sum total previous date filtered

Hi,

I need help to create a measure to Sum Total Value before the date specified in slice.

I have a stars chema

FactAccountingMoviment

SkDimDate

SkDimAccount

CreditValueMoviment

DebtValueMoviment

DimDate

SkDimDate

Date

DimAccount

SkDimAccount

Account

 

Follows the desired layout

 

AccountDatePrevious BalanceCredit MovimentDebt MovimentPeriod MovimentActual Balance
6.0.1.2.323/out100523103
6.0.1.2.324/out103743106
6.0.1.2.325/out106514110

 

I need the previous ballance dax calc

  • I look around documentation and inside forum and i create this result.

     

    PreviousBalance =
    VAR MinDate = CALCULATE( MIN('Public DimDate'[Date]), ALLSELECTED('Publico DimDate'[Date]) )
    RETURN
    CALCULATE(
    SUMX('Account FactAccountingMoviment',
    'Account FactAccountingMoviment'[CreditValue] - 'Account FactAccountingMoviment'[DebtValue])
    ,FILTER(ALL('Public DimDate'),'Public DimDate'[Date] < MinDate)
    )

1 Reply

  • I look around documentation and inside forum and i create this result.

     

    PreviousBalance =
    VAR MinDate = CALCULATE( MIN('Public DimDate'[Date]), ALLSELECTED('Publico DimDate'[Date]) )
    RETURN
    CALCULATE(
    SUMX('Account FactAccountingMoviment',
    'Account FactAccountingMoviment'[CreditValue] - 'Account FactAccountingMoviment'[DebtValue])
    ,FILTER(ALL('Public DimDate'),'Public DimDate'[Date] < MinDate)
    )