Serdia
Serdia

Reputation: 4428

How to implement tool-tip on Stacked bar chart in Power BI

I have a Stacked bar chart that displays Tasks by UserName. So each user can have: Closed Tasks - black color Overdue Tasks - red color Open Tasks - green color

enter image description here

How can I use a tool-tip so when I drag my mouse on any of tasks I want to see how many of those task are particular type.

enter image description here

For example, if I am interested in user Alison Petrarca, if I point my mouse on a green color (where value is 24) I want to see that there is 8 of them are "Audits" type; 9 of them are "Follow-up" type; 6 of them are "Pending Cancellation" type etc.

Same if I point my mouse on a red color (where value is 6) I want to see what types of tasks contain those 6.

Is it possible to achieve that?

So far I created a couple of measures for Audit type for Open and Overdue tasks:

AuditsOpen = CALCULATE(SUM(TotalCounts[OpenTasks]), TotalCounts[Type]= "Audits")
AuditsOpen = CALCULATE(SUM(TotalCounts[OpenTasks]), TotalCounts[Type]= "Audits")

But then, even if I point mouse only on green (Open Tasks) I still see Audits for open tasks and audits for Closed tasks. But I only want to see for open tasks.

enter image description here

Upvotes: 0

Views: 2052

Answers (1)

Alexis Olson
Alexis Olson

Reputation: 40204

Reshaping your data will make this fairly simple. Take your TotalCounts table and unpivot the ClosedTasks, OverdueTasks, and OpenTasks columns in the query editor so that it looks like this:

AssignedTo       | Type   | Status       | Tasks
-----------------|--------|--------------|-------
Allison Petrarca | Audits | ClosedTasks  | 6
Allison Petrarca | Audits | OverdueTasks | 3
Allison Petrarca | Audits | OpenTasks    | 8
Allison Petrarca | Claims | ClosedTasks  | 4
Allison Petrarca | Claims | OverdueTasks | 0
Allison Petrarca | Claims | OpenTasks    | 0
... (etc.) ...

Then you can put AssignedTo on your Axis, Status as your Legend, and Tasks as your Value. Then you'll create a measure for each Type you want on the tooltip. I.e.

Audits = CALCULATE(SUM(TotalCounts[Tasks]), TotalCounts[Type]="Audits")
Claims = CALCULATE(SUM(TotalCounts[Tasks]), TotalCounts[Type]="Claim")
... (etc.) ...

Upvotes: 1

Related Questions