cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Clustered Bar Chart - Percent of category/legend

I'm looking for assistance with a clustered bar chart.  I am struggling to create a measure that gives me a % of a category([Project Type] - added as Legend), not % of grand total.

 

I have a number of slicers on my report; so would need the % of the category ([Project Type]) to adjust if the slicer modifies the filter. I tried creating a measure for this (but this seems to just replicate the % of GT):

 

Turnaround_%_of_projects = COUNT(Project_Tracking[Weeks to Turnaround]) / CALCULATE( COUNT( Project_Tracking[Weeks to Turnaround]), ALLSELECTED(Project_Tracking))

 

When I tried using ALLEXCEPT - and including all of the fields from my slicers, my denominator ends up being huge for some reason.  If I tried using KEEPFILTERS with ALLEXCEPT, then the denominator does not seem to stay the same per category...

 

Turnaround_%_of_projects = COUNT(Project_Tracking[Project Type]) / CALCULATE( COUNT( Project_Tracking[Project Type]),ALLSELECTED (Project_Tracking), KEEPFILTERS( ALLEXCEPT( Project_Tracking,Project_Tracking[Project Type])))

 

In visual terms, expect the each category (Legend item) to add up to 100% (e.g. the dark bars below add to 48%)

 

 Untitled1.png

 

I would appreciate any assistance / insight anyone has on this.

 

My data looks like the below:

Untitled2.png

 

I essentially need it to show the below for the clustered chart to show the correct %s:

Untitled3.png

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Clustered Bar Chart - Percent of category/legend

@grsmith,

 

You may use the following DAX to create a new table.

Table =
ADDCOLUMNS (
    SUMMARIZE (
        Project_Tracking,
        Project_Tracking[Project Type],
        Project_Tracking[Weeks to Turnaround],
        "Count of Projects", COUNTROWS ( Project_Tracking )
    ),
    "% of Project Type", [Count of Projects]
        / COUNTROWS (
            FILTER (
                Project_Tracking,
                Project_Tracking[Project Type] = EARLIER ( Project_Tracking[Project Type] )
            )
        )
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
Highlighted
Community Support
Community Support

Re: Clustered Bar Chart - Percent of category/legend

@grsmith,

 

You may use the following DAX to create a new table.

Table =
ADDCOLUMNS (
    SUMMARIZE (
        Project_Tracking,
        Project_Tracking[Project Type],
        Project_Tracking[Weeks to Turnaround],
        "Count of Projects", COUNTROWS ( Project_Tracking )
    ),
    "% of Project Type", [Count of Projects]
        / COUNTROWS (
            FILTER (
                Project_Tracking,
                Project_Tracking[Project Type] = EARLIER ( Project_Tracking[Project Type] )
            )
        )
)
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Upcoming Events

Experience what’s next for Power BI

See the latest Power BI innovations, updates, and demos from the Microsoft Business Applications Launch Event.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Get Ready for Power BI Dev Camp

Get Ready for Power BI Dev Camp

Mark your calendars and join us for our next Power BI Dev Camp!.

Top Solution Authors
Top Kudoed Authors