Forum Discussion
Draw a bar chart using columns with single value
Hello,
I am in the process of discovering what PowerBI allows to do and I am encountering my first real challenge 🙂
I have a dataset with a list of tasks (lines). Each task can modify one or several document, and each column represents whether a document is impacted by the task, or not. It looks somerhing like this:
| Task name | Doc 1 impacted | Doc 2 impacted | Doc 2 impacted |
| Task 1 | Yes | ||
| Task 2 | Yes | Yes | |
| Task 3 | Yes | Yes | |
| ... | ... | ... | ... |
Note that a task can impact one or several documents. Now, I'd like to draw a bar chart that plots, for each document (x-axis), the number of tasks that impact it.
I thought about duplicating each task that impacts several documents (and keeping one like per impact), but this doesn't seem very straightforward or practical on the long run.
Is there a more elegant way of doing it ?
Thanks for the help.
Aurélien
1 Reply
- audreygerredSuper User
Hello! I suggest having your data formatted differently. It will help with the measure you want, and Power BI does better with narrow long tables versus wide tables (i.e. more rows, less columns).
Here is my suggestion - have a column that lists the task and a column that lists the doc affected - if a task affects 5 documents, it will have 5 rows. Then, you could do a measure like Row Count = COUNTROWS ('YourTable'). With this method I can show how many documents are affected per task and how many tasks are associated with each document:
Here is how I would set up the data:
Task Name Doc Name Impacted Task 1 Doc 1 Task 2 Doc 1 Task 2 Doc 2 Task 3 Doc 2 Task 3 Doc 3