Forum Discussion

JonasBDM's avatar
JonasBDM
Regular Visitor
4 years ago
Solved

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 so...
  • ikor42's avatar
    4 years ago

    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]
      )
  • negi007's avatar
    4 years ago

    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