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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
Snehal_123
Frequent Visitor

Measure to count people scoring below 50 %

Hi,

I want a solution for the following scenario.
I have a table with names and percentages.
I want a power query to count the people who have scored 70% to 80%

Thank you
Power query 

 

 

 

 

5 REPLIES 5
mukeshkasi25
Frequent Visitor

Hi @Snehal_123 

We can create a measure to count number of peple scoring below the required condition.
the syntax would be like:
Measure= CALCULATE(COUNT(TABLE'PERCENTAGE'), FILTER(TABLE, TABLE(PERCENTAGE)<50%))

Mahesh0016
Super User
Super User

@Snehal_123 can you please share your EndOutPut?

Input:

NamePercentage
A50.00%
B23.00%
C54.00%
A62.00%
B78.00%
C93.00%
A90.00%
B34.00%
C19.00%
A44.00%
B89.00%
C77.00%
A34.00%


Desired Output:

Below 50%6
51% to 80%4
Above 80%3

Use this code

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("TczBDcAgDEPRXXxGFSUpIceWMSL2X6MiXHz88pMj8KKgXk/FKoEvo0nGPItmHNYbMRvEXIg5v4kSu52YKrHhxMyI7YP1Aw==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Name = _t, Percentage = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Name", type text}, {"Percentage", type number}}),
    #"Added Custom" = Table.AddColumn(#"Changed Type", "Category", each if [Percentage] <= 0.5 then "Below 50%" else if [Percentage] <= 0.8 then "51% to 80%" else "Above 80%"),
    #"Grouped Rows" = Table.Group(#"Added Custom", {"Category"}, {{"Count", each Table.RowCount(_), Int64.Type}})
in
    #"Grouped Rows"
Vijay_A_Verma
Super User
Super User

Replace Source{Percentage] appropriately

=List.Count(List.Select(Source[Percentage], (x)=>x>=0.7 and x<=0.8))

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.

Top Kudoed Authors