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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How to calculate % of a count of a column?

Powerbi.PNG

I'm trying to calculate the % of waste distribution type for every month year so for example in the above image, I want a measure to calculate the % of every month so it should be like for Jan 2021 the % of Closed loop recycling =( 7/(7+15+24))*100 and same for landfill and open loop recycling. I want to display the % of waste distribution in a line chart against the date to get a trend of how much is he % of waste distrbution for every type in every month and year.

How do I create a measure for this?

1 ACCEPTED SOLUTION
WinterMist
Impactful Individual
Impactful Individual

I did not have access to your dataset, so I simply created a table based on your screenshot from the original post.

 

In my case, [Count of Waste Distribution Type] is actually a column in the table.

But you don't have this column, which is the reason for the error.

 

In your case, it's the measure.

Try replacing the SUM clause with your measure as follows:

 

CALCULATE(

   [Count of Waste distribution type],

   ALL('Waste data (3)'),

   'Calendar'[Date] = GivenDate

)

 

WinterMist_0-1679940706036.png

 

If it's still not working, perhaps you can share the PBIX on Google Drive and share the link here.

 

Regards,

Nathan

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

I created the % measure and it worked. Thank you so much 🙂 I had been stuck on this for more than 2 weeks. Thank you 🙂

Anonymous
Not applicable

The new replaced SUM clause worked for me. Can you give me the new % measure as well?

WinterMist
Impactful Individual
Impactful Individual

I did not have access to your dataset, so I simply created a table based on your screenshot from the original post.

 

In my case, [Count of Waste Distribution Type] is actually a column in the table.

But you don't have this column, which is the reason for the error.

 

In your case, it's the measure.

Try replacing the SUM clause with your measure as follows:

 

CALCULATE(

   [Count of Waste distribution type],

   ALL('Waste data (3)'),

   'Calendar'[Date] = GivenDate

)

 

WinterMist_0-1679940706036.png

 

If it's still not working, perhaps you can share the PBIX on Google Drive and share the link here.

 

Regards,

Nathan

Anonymous
Not applicable

5.PNG6.PNG

 

I tried the formula you have provided and I'm getting an error in the Count of waste distribution type in the 1st image as you can see. I've added the screenshot for the count of waste distribution type measure which I have created. Could you please help with what's going wrong?

Anonymous
Not applicable

pbi2.PNG

pbi3.PNG

I used the above formula to calculate month total and it's not giving the correct inforation and when I bring it to the visualisation it's not displaying any info.

@Anonymous 

 

Whenever this happens to me, it's helpful to separate each VAR (and the RETURN section) into its own measure to isolate smaller pieces of code.

 

If the at-fault piece of code is a CALCULATE statement, try changing it a bit to see if the issue is with the FILTER section or something else.  In this way, you should be able to identify the exact line of code that's causing the problem.

 

Once you can pinpoint which piece of code is causing the visual to break, then you need to click "See Details" to see what the error message is.

 

Regards,

Nathan

WinterMist
Impactful Individual
Impactful Individual

@Anonymous 

 

I separated this into 2 measures so you can see the results, but feel free to combine them.

 

WinterMist_0-1679604859767.png

WinterMist_1-1679604895522.png

 

WinterMist_2-1679604970730.png

 

Hopefully this is helpful to you.

 

Regards,

Nathan

 

 

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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.