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

View all the Fabric Data Days sessions on demand. View schedule

Reply
learner03
Post Partisan
Post Partisan

% of total in Table

I have a column in my table as below-   

group
 
1 to 5
6 to 10
11 to 20
1 to 5
11 to 20
1111
3333
4444
555
1 to 5
11 to 20
1 to 5
6 to 10
11 to 20
1 to 5
6 to 10
1 to 5
11 to 20
1 to 5
6 to 10
11 to 20
1111
3333
4444
555

I need the output as in a table group by 1 to 5, 6 to 10 and 11 to 20 and not take any other numbers from the group, count of lines the group is appearing in the table and then the percentage of each group with respect to total group lines. the problem is whatever measure I create when I use the measure in table it is giving output as 100% for all 3 groups, it is not dividing by total lines. I need the output as-

     
group Count lines % of total
1 to 5 7 7/17=41%
6 to 10 4 4/17=24%
11 to 20 6 6/17=35%
total 17  
1 ACCEPTED SOLUTION
BIswajit_Das
Super User
Super User

Hello @learner03 Here's a possible solution to your query
This is a sample set
x1.PNG

Now you can create a measure
i.e

Measure =
    CALCULATE(
        COUNT('Table'[Count lines]),
        ALLEXCEPT('Table','Table'[group])
    )
to get percentage of the content according to the filtered data
so
to get only "1 to 5" and others you can filter that out by this
First expand the group
i.e
x2.PNG
then select the reqiured values.
then add the measure to the table
i.e
x3.PNG
then expands the measure and select the show value as total percentage to get get your required result
x4.PNG

View solution in original post

4 REPLIES 4
BIswajit_Das
Super User
Super User

Hello @learner03 Here's a possible solution to your query
This is a sample set
x1.PNG

Now you can create a measure
i.e

Measure =
    CALCULATE(
        COUNT('Table'[Count lines]),
        ALLEXCEPT('Table','Table'[group])
    )
to get percentage of the content according to the filtered data
so
to get only "1 to 5" and others you can filter that out by this
First expand the group
i.e
x2.PNG
then select the reqiured values.
then add the measure to the table
i.e
x3.PNG
then expands the measure and select the show value as total percentage to get get your required result
x4.PNG
PhilipTreacy
Super User
Super User

Hi @learner03 

 

Download example PBIX file

 

In Power Query use this code

 

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlQoyVcwVYrViVYyAzENDcBsQ7C4EZSDUIMqDgRghjEQgBkmQABmmJqa4tdKmrUoaigxkoCLYwE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Group = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Group", type text}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each Text.Contains([Group], "to")),
    #"Grouped Rows" = Table.Group(#"Filtered Rows", {"Group"}, {{"Count", each Table.RowCount(_), Int64.Type}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Custom", each [Count] / List.Sum(#"Grouped Rows"[Count]))
in
    #"Added Custom"

 

 

percc.png

 

Regards

 

Phil

 



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


@PhilipTreacy  i can't do in power query because the group is a calculated column based on some if conditions from other columns.

@learner03 

 

That would have been useful to know in the beginning! 🙂



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


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.

Top Solution Authors
Top Kudoed Authors