Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
11 | |
11 | |
10 | |
6 |