Forum Discussion

mrothschild's avatar
mrothschild
Continued Contributor
7 years ago
Solved

Creating new table from existing data

I have a BI table with the following info:   Asset ID Duration (mos) Start date End Date A 6 3/31/2019 9/30/2019 B 12 6/30/2019 6/30/2020 C 4 7/31/2019 11/30/2019   I'd...
  • PattemManohar's avatar
    7 years ago

    mrothschild Please follow the below steps:

     

    1. Create a New Table as below (This will generate the sequence numbers from 0 till the maximum number available on the Duration field in source table. In this case it is 12)

     

    Test215Series = 
    VAR _MaxVal = MAX(Test215MultiRowSplit[Duration])
    RETURN GENERATESERIES(0,_MaxVal)

     

     

    2a. Then Create a New Table as below (Which will give a cartesian product of source table and the series table that was created above)

     

    Test215Out = CROSSJOIN(Test215MultiRowSplit,Test215Series)

    2b. Now, will remove the unnecessary records that are not required by flagging. Note I've renamed the Value field to Period field as requied. Add a new column as below

     

    RemoveFlag = IF(Test215Out[Period]<=Test215Out[Duration],"Y","N")

    2c. Filter only RemoveFlag = "Y" which are our expected records and then add a new column as below. 

     

    Month = EDATE(Test215Out[StartDate],Test215Out[Period])

    Final Result