Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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
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%))
Input:
| Name | Percentage |
| A | 50.00% |
| B | 23.00% |
| C | 54.00% |
| A | 62.00% |
| B | 78.00% |
| C | 93.00% |
| A | 90.00% |
| B | 34.00% |
| C | 19.00% |
| A | 44.00% |
| B | 89.00% |
| C | 77.00% |
| A | 34.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"
Replace Source{Percentage] appropriately
=List.Count(List.Select(Source[Percentage], (x)=>x>=0.7 and x<=0.8))
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 17 | |
| 9 | |
| 8 | |
| 7 | |
| 6 |