The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
I have a measure in dax that calculates the CPV for Google Analytics channels (d_channels).
I have a table of costs and another of sessions.
My measure calculates the CPV for each channel, but when calculating the total it should be the total invested / total sessions, disregarding the context of channels, because some channels do not have investment value only for sessions. However, when using the stacked column chart, it calculates the sum of each channel grouping, when in fact it was supposed to be calculated as total invested/total sessions. That is, instead of the total over the bars being 1.67 (0.49+1.18), it should return the value of 0.71 calculated by the measure. How can I get it to return 0.71 instead of 1.67? Below is the measurement validated by me and apparently correct.
CPV =
var final =
CALCULATE(
SUM(f_COSTS[Value])/[Session]
)
var total =
CALCULATE(
SUM(f_COSTS[Value])/[Session],
ALL(d_Canais)
)
return
SWITCH(
TRUE(),
ISINSCOPE(d_canais[GROUP2]), final,
total
)
Read about SUMX, SUMMARIZE and table variables.
User | Count |
---|---|
28 | |
11 | |
8 | |
6 | |
5 |
User | Count |
---|---|
35 | |
14 | |
12 | |
9 | |
7 |