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
JonasBDM
Regular Visitor

Sum between two columns

Hi,

 

I hope your are well. 

 

I have two table : 

First article base :

JonasBDM_0-1638371696907.png

second sales : 

JonasBDM_1-1638371725724.png

 

 

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

2 ACCEPTED SOLUTIONS
ikor42
Regular 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]
  RETURN
    SUMX (
      FILTER ( sales, sales[Art] = _current_art ),
      sales[QTE]
  )

View solution in original post

negi007
Community Champion
Community 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




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

View solution in original post

3 REPLIES 3
negi007
Community Champion
Community 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




Did I answer your question? Mark my post as a solution!
Appreciate your Kudos



Proud to be a Super User!


Follow me on linkedin

shanecosgrove1
Frequent 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.
shanecosgrove1_0-1638372593700.png

 

ikor42
Regular 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]
  RETURN
    SUMX (
      FILTER ( sales, sales[Art] = _current_art ),
      sales[QTE]
  )

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.