Forum Discussion

numersoz's avatar
numersoz
Helper III
6 years ago
Solved

Calculated Table from Another Table Info

Hi, I have a table with below information on Power BI: ID Benefit Date Saving/year 1 1/1/2013 $5 2 3/5/2014 $3 3 4/6/2014 $15 4 5/5/2015 $20 5 8/8/2015 $27 T...
  • Greg_Deckler's avatar
    6 years ago

    So, something like this?

     

    Table3 = 
    VAR __ids = DISTINCT(SELECTCOLUMNS('Table2',"__ID",[ID]))
    VAR __years = DISTINCT(SELECTCOLUMNS(ADDCOLUMNS(SELECTCOLUMNS(Table2,"__Date",[Benefit Date]),"__Year",YEAR([__Date])),"__Year",[__Year]))
    VAR __table = GENERATEALL(__ids,__years)
    VAR __table1 = ADDCOLUMNS(__table,"__Savings/year",MAXX(FILTER('Table2',[ID] = [__ID]),[Saving/year]))
    RETURN __table1
    See attached.

    See attached.