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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
Syndicate_Admin
Administrator
Administrator

Line chart with percentage per month by category

Hello

I'm new to Power BI and wanted to know if you can help me:

I have the following line chart

juanpar_0-1713389724420.png

They are counting samples over several months and subdivided into 4 categories. I need you to show me not the count of each category in each month but the percentage that each category represents of each month's total.

Thank you

1 ACCEPTED SOLUTION
Syndicate_Admin
Administrator
Administrator

Thank you so much for the help!

By the time you answered, I had already found a solution:

I made the following measurements:

samples = count('table'[numberofsamples])

%samples = divide([samples], calculate([samples], allselected('table'[category])))

Then, in the line graph, on the Y-axis I put the measure %samples and in Legend I put 'table'[category]

View solution in original post

2 REPLIES 2
Syndicate_Admin
Administrator
Administrator

Thank you so much for the help!

By the time you answered, I had already found a solution:

I made the following measurements:

samples = count('table'[numberofsamples])

%samples = divide([samples], calculate([samples], allselected('table'[category])))

Then, in the line graph, on the Y-axis I put the measure %samples and in Legend I put 'table'[category]

samratpbi
Responsive Resident
Responsive Resident

Hi,

it seems the measure you have created is returning count which you are using in values and categories in legend. You can create another measure share which would be count / total count.
I am not sure about the data, but if your count measure is like below:
cnt = distinctcount(samples)
then create another measure like
Total cnt = CALCULATE(distinctcount(samples), ALL(T1.category)) that will remove category filter.
Then Share cnt = cnt / Total cnt

Since data is not available, I am providing kind of pseudo code. Hope this helps.


If this help you to resolve your problem, then please mark it as solution, Thanks!

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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