Forum Discussion

Syndicate_Admin's avatar
Syndicate_Admin
Icon for Administrator rankAdministrator
4 years ago
Solved

Create a chart with an average DAX measurement

Hello

I'm trying to make a graph of a variable called CPA (Cost Per Acquisition) that shows what it costs a company to sell a product. To display this variable is calculated as follows:

data_operador1_1-1641829923492.png

The other measures created are also sums:

data_operador1_2-1641829988143.png

data_operador1_3-1641830012909.png

And the variable inside a meter looks like this:

data_operador1_0-1641829886601.png

I have the problem when I try to show the evolution of that CPA (that measure) over several months. The graph divides the total CPA that I have obtained in the 12 months and gives results whose sum is 87.84 (the problem is that the values of each month should obtain an average of 87.84). Here is the example:

data_operador1_4-1641830691480.png

Obviously I have done something wrong, but I do not know how to make the formula in DAX so that it gives good.

Thank you so much.

Greetings

  • Anonymous's avatar
    Anonymous
    4 years ago

    Hi data_operador1 ,

    Did you mean that the column chart's data displayed incorrectly, it should show 87.84 for each month? How is your column chart visual set (Axis: Month  Values: [CPA TOTAL])? Please provide the relevant calculation logic and a specific example to illustrate the correct result. Thank you.

    And you can change the formula of your measure [CPA TOTAL] to look like this and check later if you can get the correct result...

    CPA TOTAL =
    DIVIDE (
        SUM ( Inversion_Digital_Particion[Coste] ) + Inversion_Digital_Particion[Externa_Coste_Hora_Agente],
        SUMX (
            ALLSELECTED ( Inversion_Digital_Particion ),
            Inversion_Digital_Particion[Externa_Numero_Asegurados]
        ),
        0
    )

    Best Regards

3 Replies

  • Syndicate_Admin ,based on what I got

     

    if you want the overall value in bar visual , the use allselected or all in visual

     

    example

    calculate(divide([A], [B]), allselected(Table)) //Where A and b are measures

     

    or

     

    calculate(divide([A], [B]), all(Table)) //Where A and b are measures

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi data_operador1 ,

    Did you mean that the column chart's data displayed incorrectly, it should show 87.84 for each month? How is your column chart visual set (Axis: Month  Values: [CPA TOTAL])? Please provide the relevant calculation logic and a specific example to illustrate the correct result. Thank you.

    And you can change the formula of your measure [CPA TOTAL] to look like this and check later if you can get the correct result...

    CPA TOTAL =
    DIVIDE (
        SUM ( Inversion_Digital_Particion[Coste] ) + Inversion_Digital_Particion[Externa_Coste_Hora_Agente],
        SUMX (
            ALLSELECTED ( Inversion_Digital_Particion ),
            Inversion_Digital_Particion[Externa_Numero_Asegurados]
        ),
        0
    )

    Best Regards

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi data_operador1 ,

    Whether your problem has been resolved? If yes, could you please mark your post as Answered? It will help the others in the community find the solution easily if they face the same problem with you. Thank you.

    Best Regards