Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
1 year ago
Solved

Calculate Quarterly Data from Cumulative Data

I have three data tables: Date, Accounts, and IncomeStatement. The Income Statement table contains cumulative data for three companies—FPT, HPG, and PNJ—specifically for two accounts: Gross Sales and...
  • Selva-Salimi's avatar
    Selva-Salimi
    1 year ago

    Anonymous 

     

    if you want to write a measure, you can try this measure:

     

    Quarterly_Amount_measure = var prev_Q=calculate(max('Date'[Date Key]) , filter(all('Date'[Date Key]) , 'Date'[Date Key] < selectedvalue('Date'[Date Key])))
    return
    sum(IncomeStatement[Amount]) - CALCULATE(sum(IncomeStatement[Amount]) , filter(all(IncomeStatement) , IncomeStatement[Date Key]=prev_Q && IncomeStatement[Security Key]=SELECTEDVALUE(IncomeStatement[Security Key]) && IncomeStatement[Account Key] in values(Accounts[Account Key]) && year(IncomeStatement[Date Key])=selectedvalue('Date'[Year]) ))
     
    keep in mind that rows and columns in matrix should be selected from Account and Date table.
    let me know if this is your expectation.
     

     

     
    If this post helps, then I would appreciate a thumbs up  and mark it as the solution to help the other members find it more quickly.