I have below columns: ID 1, 1, 2, 3, 3, 4... Attribute (4 attributes) Online booking, In flight wifi Service Services in the plane Cleanliness Value 4 5 6 ..., Customer type: first time returned I would like to calculate NPS score and visualize it in a stacked bar chart as a tooltip.
It shows me the same NPS score for each attribute, for each areas (Passives, Detractors and Promoters). How can I solve this?
I have below:
Passives = CALCULATE(
COUNTROWS(Satisfaction),
Satisfaction[Value] = 3,
Satisfaction[Customer type] = "First-time"
)
Detractors = CALCULATE(
COUNTROWS(Satisfaction),
Satisfaction[Value] >= 1,
Satisfaction[Value] <= 2,
Satisfaction[Customer type] = "First-time"
)
Promoters = CALCULATE(
COUNTROWS(Satisfaction),
Satisfaction[Value] >= 4,
Satisfaction[Value] <= 5,
Satisfaction[Customer type] = "First-time")
NPS Score:
NPS by attribute Score =
var CurrentAttribute = SELECTEDVALUE(Satisfaction[Attribute])
var TotalResponses = CALCULATE(
COUNTROWS(Satisfaction),
ALLEXCEPT(Satisfaction,
Satisfaction[Attribute])
)
var PromotersCount = CALCULATE(
COUNTROWS(Satisfaction),
Satisfaction[Value] >= 4,
Satisfaction[Value] <= 5,
Satisfaction[Customer type] = "First-time",
ALLEXCEPT(Satisfaction,
Satisfaction[Attribute]
))
var DetractorCount = CALCULATE(
COUNTROWS(Satisfaction),
Satisfaction[Value] >= 1,
Satisfaction[Value] <= 2,
Satisfaction[Customer type] = "First-time",
ALLEXCEPT(Satisfaction,
Satisfaction[Attribute]
))
var PromoterPercentage = DIVIDE(PromotersCount, TotalResponses, 0)
VAR DetractorPercentage = DIVIDE(DetractorCount, TotalResponses, 0)
RETURN
(PromoterPercentage - DetractorPercentage) * 100
```
This is what it should look like:
[1]: https://i.stack.imgur.com/NAVXA.png
Different scores for each bar (Detractor, Promoter)
This is what I have:
[2]: https://i.stack.imgur.com/moOAI.png
Same score for each bar -> something is wrong