Forum Discussion
Sum between two columns
Hi,
I hope your are well.
I have two table :
First article base :
second sales :
In the article base, I would like to display the sum of sales for each article. Can someone help me please ?
Thank you in advance.
JL6
Hi,
depends if there is a relationship between tables.If exists - simply add new column as
Sales =SUMX (RELATEDTABLE ( sales ),sales[QTE]
)If there is no relationship just add column as:Sales =VAR _current_art = 'Article Base'[ART]RETURNSUMX (FILTER ( sales, sales[Art] = _current_art ),sales[QTE])JonasBDM you just need to create relationship between these two tables on ART columns of both tables. then you use the ART column from the first table and QTE from the second table in the matrix visual. you will get sum by ART. there is no need to create any measure but relationship between tables will do the job. thanks
3 Replies
- ikor42Regular Visitor
Hi,
depends if there is a relationship between tables.If exists - simply add new column as
Sales =SUMX (RELATEDTABLE ( sales ),sales[QTE]
)If there is no relationship just add column as:Sales =VAR _current_art = 'Article Base'[ART]RETURNSUMX (FILTER ( sales, sales[Art] = _current_art ),sales[QTE]) - negi007Community Champion
JonasBDM you just need to create relationship between these two tables on ART columns of both tables. then you use the ART column from the first table and QTE from the second table in the matrix visual. you will get sum by ART. there is no need to create any measure but relationship between tables will do the job. thanks
- shanecosgrove1Frequent Visitor
Hi,
You could use a dax function to add a new column called Sum of Sales to the Article table.
Sum of Sales = CALCULATE(Sum('Sales'[QTE]),FILTER('Sales','Sales'[Art] = Article[ART]))The above will yield the below results.