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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Jhadur
Helper I
Helper I

Stacked bar chart, unique count of projects

I am using a stacked bar chart to display the number of projects in each status color by VP. I need to count the unique project codes when the ALL slicer is selectd for the project month. The table feeding this visualization has a line for each month a project update report was submitted, so each project has multiple lines and I need a count of the unique project codes. I appreciate your assistance.

 

Project CodeOPProject NameStartFinishForecast Delivery DateSponsorReport StatusStatus Report Date
PRJ01OP01OP01 project 12022-03-012024-10-312024-10-31VP NameFinal2024-01-23
PRJ01OP01OP01 project 12022-03-012024-12-062024-12-06VP NameFinal2024-02-20
PRJ01OP01OP01 project 12022-03-012025-07-092025-07-09VP NameFinal2024-03-19
PRJ01OP01OP01 project 12022-03-012025-07-092025-07-09VP NameFinal2024-04-15
PRJ02OP02OP02 project 22024-05-012024-12-062024-12-06VP NameFinal2024-01-23
PRJ02OP02OP02 project 22024-05-012024-12-062024-12-06VP NameFinal2024-02-20
PRJ02OP02OP02 project 22024-05-012024-12-062024-12-06VP NameFinal2024-03-19
PRJ02OP02OP02 project 22024-05-012024-12-062024-12-06VP NameFinal2024-04-15

 

Jhadur_0-1726068466260.png

This is the dashboard. The project count of 31 is correct as is the not green, which is counting only one time that the project went not green, not every month. As you can see the stacked bar chart's count is not consistent with those numbers.

3 REPLIES 3
v-rzhou-msft
Community Support
Community Support

Hi @Jhadur ,

 

It looks like that you want to show distinct count value in your visual. Here I suggest you to try distinct count function in value field in your stacked bar chart.

I think your issue should be caused by your data model. I am confused about how to calculate red/green /yellow. Please show us the calculation logic about how to count them in your report. Or you can show us a screenshot with the result you want based on the sample you share above.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

HI @v-rzhou-msft 

 

This is the filter and visualization for the stacked bar chart. I don't see an option for a value field. 

Jhadur_0-1726148540851.png

This is the measure that I am using for the count of projects that returns the correct count of 31. 

 

 

Count of Projects = DISTINCTCOUNT(Projects[Project Code]) +0

 

I use the same measure for the Not Green count that returns the correct count of 19 with an additional filter on the status color to return only red or amber.

This is the updated table with the status values added. 10=green, 20=amber, 30=red. The stacked bar chart should only count a project not green once even if it is not green for multiple months.

Project CodeOPProject NameStartFinishForecast Delivery DateSponsorReport StatusStatus Report DateOverall Status
PRJ01OP01OP01 project 12022-03-012024-10-312024-10-31VP NameFinal2024-01-2320
PRJ01OP01OP01 project 12022-03-012024-12-062024-12-06VP NameFinal2024-02-2030
PRJ01OP01OP01 project 12022-03-012025-07-092025-07-09VP NameFinal2024-03-1930
PRJ01OP01OP01 project 12022-03-012025-07-092025-07-09VP NameFinal2024-04-1530
PRJ02OP02OP02 project 22024-05-012024-12-062024-12-06VP NameFinal2024-01-2310
PRJ02OP02OP02 project 22024-05-012024-12-062024-12-06VP NameFinal2024-02-2020
PRJ02OP02OP02 project 22024-05-012024-12-062024-12-06VP NameFinal2024-03-1920
PRJ02OP02OP02 project 22024-05-012024-12-062024-12-06VP NameFinal2024-04-1520

 

The result I need is for the total project count of the stacked bar chart to match the Projects count of 31 and the Not Green count of 19, a combination of the red and amber projects, when all months are selected in the slicer. If I select an individual month I get a correct count, it is only when selecting all months that it is not counting unique projects and status.

 

Jhadur_1-1726149453291.png

This is an example of a single month and all the counts match up and are correct.

Hi @Jhadur ,

 

According to your statement, I am confused that what is the X axis. Is it [Project Code]? I see that you select 2024 January in your slicer, I think it should only show one status for each Project Code.

I create a sample by your data.

vrzhoumsft_0-1727160756931.png

vrzhoumsft_1-1727160770787.png

Please share a sample file with us.

 

Best Regards,
Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code FABINSIDER for a $400 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

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

March2025 Carousel

Fabric Community Update - March 2025

Find out what's new and trending in the Fabric community.