## Desktop

Regular Visitor
Posts: 18
Registered: ‎05-09-2017

# Add new table with calculated lines

Hello everybody,

I need your help to create a new table with conditions. I know how to create a new table, but don't what is the formula to calculated what I want :

I have the first table, and I want the new one.

Thanks a lot for your help,

Joc

Accepted Solutions
Community Support Team
Posts: 7,505
Registered: ‎08-14-2016

## Re: Add new table with calculated lines

Hi @joc,

You can use below table formula to summary original table records:

```Summary Table =
SUMMARIZE('Test Table',[Week],"Col 1",SUMX(FILTER('Test Table',[Week]=EARLIER('Test Table'[Week])&&OR('Test Table'[Name]="A",'Test Table'[Name]="B")),[Value])),
"Col 2",[Col 1]+[Col 1]/2),
"Col 3",[Col 1]-[Col 2])```

Based on your result table, you 'col2' formula should be "A+B+(C+D)/2", right?
If this is a case, you can use below formula to instead:

```Summary Table =
SUMMARIZE('Test Table',[Week],"Col 1",SUMX(FILTER('Test Table',[Week]=EARLIER('Test Table'[Week])&&OR('Test Table'[Name]="A",'Test Table'[Name]="B")),[Value])),
"Col 2",[Col 1]+(SUMX(FILTER('Test Table',[Week]=EARLIER('Test Table'[Week])),[Value])-[Col 1])/2),
"Col 3",[Col 1]-[Col 2])```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For learning resources/Release notes, please visit: | |

All Replies
Community Support Team
Posts: 7,505
Registered: ‎08-14-2016

## Re: Add new table with calculated lines

Hi @joc,

You can use below table formula to summary original table records:

```Summary Table =
SUMMARIZE('Test Table',[Week],"Col 1",SUMX(FILTER('Test Table',[Week]=EARLIER('Test Table'[Week])&&OR('Test Table'[Name]="A",'Test Table'[Name]="B")),[Value])),
"Col 2",[Col 1]+[Col 1]/2),
"Col 3",[Col 1]-[Col 2])```

Based on your result table, you 'col2' formula should be "A+B+(C+D)/2", right?
If this is a case, you can use below formula to instead:

```Summary Table =
SUMMARIZE('Test Table',[Week],"Col 1",SUMX(FILTER('Test Table',[Week]=EARLIER('Test Table'[Week])&&OR('Test Table'[Name]="A",'Test Table'[Name]="B")),[Value])),
"Col 2",[Col 1]+(SUMX(FILTER('Test Table',[Week]=EARLIER('Test Table'[Week])),[Value])-[Col 1])/2),
"Col 3",[Col 1]-[Col 2])```

Regards,

Xiaoxin Sheng

Community Support Team _ Xiaoxin Sheng
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

For learning resources/Release notes, please visit: | |
Highlighted
Regular Visitor
Posts: 18
Registered: ‎05-09-2017

## Re: Add new table with calculated lines

Perfect thanks a lot !