Forum Discussion

SarahAlsterspre's avatar
3 years ago
Solved

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:

campaignIDOpeningsCustomerClicks
11200114
1120013243
11200123
26903283
26901483
2690321
26901149

 

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

  • SarahAlsterspre,

     

    Try these measures:

     

    Openings by Customer = 
    VAR vTable =
        ADDCOLUMNS (
            VALUES ( Campaign[CampaignID] ),
            "@Openings", CALCULATE ( MAX ( Campaign[Openings] ) )
        )
    VAR vResult =
        SUMX ( vTable, [@Openings] )
    RETURN
        vResult
    Openings by Customer Total = 
    SUMX ( VALUES ( Campaign[Customer] ), [Openings by Customer] )

     

    The "Total" measure is necessary to correctly calculate totals:

     

     

3 Replies

  • 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] ) )
                       )
    RETURN
    SUMX(
        vTable,
        [@Openings]
    )
  • SarahAlsterspre,

     

    Try these measures:

     

    Openings by Customer = 
    VAR vTable =
        ADDCOLUMNS (
            VALUES ( Campaign[CampaignID] ),
            "@Openings", CALCULATE ( MAX ( Campaign[Openings] ) )
        )
    VAR vResult =
        SUMX ( vTable, [@Openings] )
    RETURN
        vResult
    Openings by Customer Total = 
    SUMX ( VALUES ( Campaign[Customer] ), [Openings by Customer] )

     

    The "Total" measure is necessary to correctly calculate totals: