Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
JDpowerBI
New Member

Create Bar Chart That Compares Counts Of Values Across Multiple Columns

Hi Everyone.  I have a challenging question around creating a specific type of bar chart.   Based on the data below, you can see that there are 5 Resources (column headers).  The Row data are  job IDs.  The values are names.  Any name can be used more then once per row, and with no order logic.    I have a few goals with this data.  The first goal is to produce a bar chart which counts how jobs each person participated in.  If a name is used twice per row, i want that counted as a distinct comination of name and job ID. 

 

The table 2nd table displays the count per name of distinct job/name combinations.  How does one accomdate this in a Power BI visual?  What keeps throwing me off too is that i'm not really incorporating the column header into the chart (Resource 1, Resource 2 etc).

 

Appreciate the help!

 

Capture.JPG

7 REPLIES 7
Ashish_Mathur
Super User
Super User

Hi,

RIght click on the Job ID number column in the Query Editor and select "Unpivot other columns".  Drag the Value field to the visual and write this measure

=DISTINCTCOUNT(Data[Job ID])

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Thanks for the response @Ashish_Mathur !   That seems to have solved my problem.  However, by unpivoting the data, that seemed to have messed up the visualizations i had that were based on the data before being unpivoted.    I must also add that the table described above actually has many more columns in it (probably 30 or so) that i do NOT want included in this chart visual (But are relevant for other visualization on my dashboard).  In order to unpivot, it made sense to "Choose columns" and reduce the set of data to unpivot to only filter down to the columns that i want to unpivot).     

 

Does this mean i need multiple queries so some visualizations can be based on the unpivoted data, and others will be based on the normal set?

Anonymous
Not applicable

Hi @JDpowerBI,

Perhaps you can try to duplicate the original query table and do unpivot columns on it, save changes and return to the data view side. (you can use the category column as the relationship key to link both two tables)
After these steps, you can simply create visuals based on two table fields and do interaction between different visuals.
Regards,

Xiaoxin Sheng

You are welcome.  No, you should not need multiple queries.  All your visuals and calculations should be based on the unpivoted dataset.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

Hi @Ashish_Mathur,. Since my "EVENT" table which contains the Resource columns listed above, and additional columns, how do i filter down the measure to only use specific columns in the count? =DISTINCTCOUNT(Data[Job ID])

 

I know we can use the filter where the visuals are too, but is that the only way?

Hi,

I do not understand your question.  Share some data and show the expected result.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

I think you better unpivot this data https://radacad.com/pivot-and-unpivot-with-power-bi

Can you share sample data and sample output. Mark me @

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors