Forum Discussion
single addition
Hello,
I have the following problem: I want to add all the openings generated for each customer without double counting. In each mail-Campaign (CampaignID) there is one number of openings of the newsletter. And within one newsletter there are several articles with different clicks. So I get the following table:
| campaignID | Openings | Customer | Clicks |
| 1 | 1200 | 1 | 14 |
| 1 | 1200 | 13 | 243 |
| 1 | 1200 | 1 | 23 |
| 2 | 690 | 3 | 283 |
| 2 | 690 | 1 | 483 |
| 2 | 690 | 3 | 21 |
| 2 | 690 | 1 | 149 |
What I need is a measure that calculates the following results:
Openings Customer 1 = Campaign 1+2 = 1200+690 = 1890
Openings Customer 3 = Campaign 1 = 690
...
Does anyone have a solution here that the openings dont get double added when a customer has clicks twice in a campaign?
Im looking forward to any solution
Greets
Sarah
Try these measures:
Openings by Customer = VAR vTable = ADDCOLUMNS ( VALUES ( Campaign[CampaignID] ), "@Openings", CALCULATE ( MAX ( Campaign[Openings] ) ) ) VAR vResult = SUMX ( vTable, [@Openings] ) RETURN vResultOpenings by Customer Total = SUMX ( VALUES ( Campaign[Customer] ), [Openings by Customer] )The "Total" measure is necessary to correctly calculate totals:
3 Replies
- mangaus1111Solution Sage
Hi SarahAlsterspre ,
if you use SUMMARIZE, instead of VALUES, you don´t need to create 2 measures
Openings by Customer =VAR vTable = ADDCOLUMNS(SUMMARIZE(Newsletter,Newsletter[Customer],Newsletter[campaignID]),"@Openings",CALCULATE(MAX ( Newsletter[Openings] ) ))RETURNSUMX(vTable,[@Openings]) - DataInsightsSuper User
Try these measures:
Openings by Customer = VAR vTable = ADDCOLUMNS ( VALUES ( Campaign[CampaignID] ), "@Openings", CALCULATE ( MAX ( Campaign[Openings] ) ) ) VAR vResult = SUMX ( vTable, [@Openings] ) RETURN vResultOpenings by Customer Total = SUMX ( VALUES ( Campaign[Customer] ), [Openings by Customer] )The "Total" measure is necessary to correctly calculate totals:
- SarahAlsterspreHelper II
thank you so much - it works!