Forum Discussion

ysherriff's avatar
ysherriff
Resolver II
4 years ago
Solved

Split total by group

In the image below, i have some duplicate values, which is okay but I would like to split the total over the entire group. For instance, in the below image, for BC#1598-01, it has a value of $5,812,2...
  • v-yadongf-msft's avatar
    v-yadongf-msft
    3 years ago

    Hi ysherriff ,

     

    Please try following DAX, you will get the SUM in total:

     

    Avg $ Global or Potential = 
    IF(
        ISINSCOPE(Campaigns[Campaigns ID]),
        Divide(
    CALCULATE(
    AVERAGE( Campaigns[Global or Potential]),
    FILTER(
    ALL( Campaigns),
    Campaigns[BC #] = MAX(Campaigns[BC #]))) ,
    CALCULATE(
    Count( Campaigns[Campaigns ID]),
    FILTER(
    ALL( Campaigns),
    Campaigns[BC #] = MAX(Campaigns[BC #]))) ),
    SUM(Campaigns[Global or Potential])
    )

     

     

    Best regards,

    Yadong Fang

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • ysherriff's avatar
    ysherriff
    3 years ago

    Here is the formula:

    Thanks Yadong Fang. Below is the formula that was provided that was correct.

     

     

    Correct Average Total Amount =
    IF( ISINSCOPE( Campaigns[Campaign ID] ) ,
        [Average $ Global or Potential] ,
        SUMX(
            ADDCOLUMNS(
                SUMMARIZE(
                    Campaigns ,
                    Campaigns[Campaign ID] ,
                    Campaigns[BC #] ) ,
                "@Totals" ,
                [Average $ Global or Potential] ) ,
            [@Totals] ) )