Forum Discussion

jiangxm80's avatar
jiangxm80
Icon for Helper I rankHelper I
2 years ago
Solved

how to build a table?

I have a table like the following format.

YearNo    Customer    SalesAmount

2023        A                 1000

2023        B                 1500

2023        C                  800

2024        A                  1200

2024        C                   600

2024        D                  500

 

and I would like to create a table as the following

Customer   SalesDiff

A                 200

B                 -1500

C                 -200

D                 500

 

Thanks.

  • jiangxm80 

    pls try this

    Table 2 =
    SUMMARIZE('Table','Table'[Customer],"salesdiff",CALCULATE(sum('Table'[SalesAmount]),'Table'[YearNo]="2024")-cALCULATE(sum('Table'[SalesAmount]),'Table'[YearNo]="2023"))
     
     
    pls see the attachment below

1 Reply

  • jiangxm80 

    pls try this

    Table 2 =
    SUMMARIZE('Table','Table'[Customer],"salesdiff",CALCULATE(sum('Table'[SalesAmount]),'Table'[YearNo]="2024")-cALCULATE(sum('Table'[SalesAmount]),'Table'[YearNo]="2023"))
     
     
    pls see the attachment below