title: 10 calculated field for each row
body: <p>I need to write a query that shows all the accountnumbers and then I need to show the next 10 closing balances from the next 10 days from a specific startdate.</p>
  
  <p>I have a dimension with accounts, a dimension with dates and a fact balance table that stores the opening and closing balance for each of the accounts. </p>
  
  <p>The output needs to look like this:</p>
  
  <p>BANK_NAME |  ACCOUNT_NR |  CB DATE1 |  CB DATE1 +1 |  CB DATE1 +2 .... | untill 10</p>
  
  <p>I've tried to write a query like this:</p>
  
  <pre><code>    select information.bankname,information.branchname,information.holdername,information.accountnumber, information.CURRENCY, CB1.amount1, CB2.amount2, CB3.amount3, CB4.amount4, CB5.amount5, CB6.amount6, CB7.amount7,  CB8.amount8, CB9.amount9, CB10.amount10
  from 
  --eerste gegevens selecteren
  (select a.BANK_NAME bankname, a.BRANCH_NAME branchname, a.HOLDER_NAME holdername, a.ACCOUNT_NUMBER accountnumber, a.CURRENCY currency
  --relaties worden gelegd
  from DIM_ACCOUNT a, FACT_AS_BALANCE b, DIM_DATE d 
  where
  b.balance_date_id = d.ID and
  b.account_id = a.ID and
  ) information,
  
  (select FACT_AS_BALANCE.CB_AMOUNT amount1
  --relaties worden gelegd
  from DIM_ACCOUNT a, FACT_AS_BALANCE b, DIM_DATE d 
  where
  b.balance_date_id = d.ID and
  b.account_id = a.ID and
  (d.CAL_DATE = TO_DATE ('20130101', 'YYYYMMDD'))) CB1,
  
  (select FACT_AS_BALANCE.CB_AMOUNT amount2
  --relaties worden gelegd
  from DIM_ACCOUNT a, FACT_AS_BALANCE b, DIM_DATE d 
  where
  b.balance_date_id = d.ID and
  b.account_id = a.ID and
  (d.CAL_DATE = TO_DATE ('20130101', 'YYYYMMDD') + 1)) CB2,
  
  (select FACT_AS_BALANCE.CB_AMOUNT amount3
  --relaties worden gelegd
  from DIM_ACCOUNT a, FACT_AS_BALANCE b, DIM_DATE d 
  where
  b.balance_date_id = d.ID and
  b.account_id = a.ID and
  (d.CAL_DATE = TO_DATE ('20130101', 'YYYYMMDD') + 2)) CB3,
  
  (select FACT_AS_BALANCE.CB_AMOUNT amount4
  --relaties worden gelegd
  from DIM_ACCOUNT a, FACT_AS_BALANCE b, DIM_DATE d 
  where
  b.balance_date_id = d.ID and
  b.account_id = a.ID and
  (d.CAL_DATE = TO_DATE ('20130101', 'YYYYMMDD') + 3)) CB4,
  
  (select FACT_AS_BALANCE.CB_AMOUNT amount5
  --relaties worden gelegd
  from DIM_ACCOUNT a, FACT_AS_BALANCE b, DIM_DATE d 
  where
  b.balance_date_id = d.ID and
  b.account_id = a.ID and
  (d.CAL_DATE = TO_DATE ('20130101', 'YYYYMMDD') + 4)) CB5,
  
  (select FACT_AS_BALANCE.CB_AMOUNT amount6
  --relaties worden gelegd
  from DIM_ACCOUNT a, FACT_AS_BALANCE b, DIM_DATE d 
  where
  b.balance_date_id = d.ID and
  b.account_id = a.ID and
  (d.CAL_DATE = TO_DATE ('20130101', 'YYYYMMDD') + 5)) CB6,
  
  (select FACT_AS_BALANCE.CB_AMOUNT amount7
  --relaties worden gelegd
  from DIM_ACCOUNT a, FACT_AS_BALANCE b, DIM_DATE d 
  where
  b.balance_date_id = d.ID and
  b.account_id = a.ID and
  (d.CAL_DATE = TO_DATE ('20130101', 'YYYYMMDD') + 6)) CB7,
  
  (select FACT_AS_BALANCE.CB_AMOUNT amount8
  --relaties worden gelegd
  from DIM_ACCOUNT a, FACT_AS_BALANCE b, DIM_DATE d 
  where
  b.balance_date_id = d.ID and
  b.account_id = a.ID and
  (d.CAL_DATE = TO_DATE ('20130101', 'YYYYMMDD') + 7)) CB8,
  
  (select FACT_AS_BALANCE.CB_AMOUNT amount9
  --relaties worden gelegd
  from DIM_ACCOUNT a, FACT_AS_BALANCE b, DIM_DATE d 
  where
  b.balance_date_id = d.ID and
  b.account_id = a.ID and
  (d.CAL_DATE = TO_DATE ('20130101', 'YYYYMMDD') + 8)) CB9,
  
  (select FACT_AS_BALANCE.CB_AMOUNT amount10
  --relaties worden gelegd
  from DIM_ACCOUNT a, FACT_AS_BALANCE b, DIM_DATE d 
  where
  b.balance_date_id = d.ID and
  b.account_id = a.ID and
  (d.CAL_DATE = TO_DATE ('20130101', 'YYYYMMDD') + 9)) CB10;
  </code></pre>
  
  <p>I don't know if this is the correct way of doing this. But I really don't see any other way.</p>
  
  <p>How can i do this ?</p>