Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
joc
Helper I
Helper I

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 :

 

Sans titre.png 

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

 

Thanks a lot for your help,

Joc

1 ACCEPTED SOLUTION
v-shex-msft
Community Support
Community Support

Hi @joc,

 

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

Summary Table = 
ADDCOLUMNS(
    ADDCOLUMNS(
        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])

9.PNG

 

 

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 = 
ADDCOLUMNS(
    ADDCOLUMNS(
        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
If this post helps, please consider accept as solution to help other members find it more quickly.

View solution in original post

2 REPLIES 2
v-shex-msft
Community Support
Community Support

Hi @joc,

 

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

Summary Table = 
ADDCOLUMNS(
    ADDCOLUMNS(
        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])

9.PNG

 

 

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 = 
ADDCOLUMNS(
    ADDCOLUMNS(
        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
If this post helps, please consider accept as solution to help other members find it more quickly.

Perfect thanks a lot !

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.