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

Join the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now

Reply
ishzoulify
Regular Visitor

Pct based on Type

Hello Guys,

 

Please help on the correct DAX formula.

 

For example, I have this source. I just need to get the percentage of colors based on the total count.

I have seen some of the formula here but that is for numeric.

 

Type

Red

Red

Red

Blue

Green

Red

Blue

Green

Green

Red

 

Total is 10

 

Type       Count       Pct

Red             5         50%

Blue            2          20%

Green         3          30%

 

Hope you can help.

Thanks,

1 REPLY 1
dm-p
Super User
Super User

Hi @ishzoulify,

I've replicated your data into a table named Colours, which is how the following examples will be written for. You can do thi sin less steps, but this is how I would approach it, as I can re-use the measures later if I need to.

Create the following measures:

# Colours = COUNTROWS(Colours)
# Total Colours = CALCULATE(
    [# Colours],
    ALL(Colours[Type])
)

The ALL removes the filter on Type, which means that for each row it will count everything.

% of Total = DIVIDE(
    [# Colours],
    [# Total Colours]
)

This measure then gets formatted as a percentage.

Here's my results, with all measures shown for completeness:

image.png

Here's a copy of my workbook for your reference, in case you want to check anything.

Regards,

Daniel


If my post solves your challenge, then please consider accepting as a solution to help other forum members find the answer more quickly 🙂





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!


On how to ask a technical question, if you really want an answer (courtesy of SQLBI)




Helpful resources

Announcements
April Power BI Update Carousel

Power BI Monthly Update - April 2026

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

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

FabCon and SQLCon Highlights Carousel

FabCon &SQLCon Highlights

Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.