Forum Discussion
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:
The other measures created are also sums:
And the variable inside a meter looks like this:
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:
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
- Anonymous4 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
- amitchandak
Super User
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
- AnonymousNot 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
- AnonymousNot 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