Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Power Query help to calculate count column.
if Store is same and Brand and type is also same for all rows then count should be 1. (from below example Apple)
If store is same but two different combination of Brand and Type then count should be 2 and so on. (From below example Samsung)
Data
Brand | Type | Store |
Apple | Iphone | NYC |
Apple | Iphone | NYC |
Samsung | S22 | NJ |
Samsung | S21 | NJ |
Samsung | S21 | NJ |
Result
Brand | Type | Store | Count |
Apple | Iphone | NYC | 1 |
Apple | Iphone | NYC | 1 |
Samsung | S22 | NJ | 2 |
Samsung | S21 | NJ | 2 |
Samsung | S21 | NJ | 2 |
Solved! Go to Solution.
Hi PSB!
You can do the column in two steps. First you want to do the distinct count group by brand, then you can expand the result.
In the advanced editor, it should look like this:
#"Grouped Rows" = Table.Group(#"Changed Type", {"Brand"}, {{"Count", each Table.RowCount(Table.Distinct(_)), Int64.Type}, {"All", each _, type table [Brand=nullable text, Type=nullable text, Store=nullable text]}}),
#"Removed Columns" = Table.RemoveColumns(#"Grouped Rows",{"Brand"}),
#"Expanded All" = Table.ExpandTableColumn(#"Removed Columns", "All", {"Brand", "Type", "Store"}, {"Brand", "Type", "Store"})"All.Type", "All.Store"})
Cheers!
Hi PSB!
You can do the column in two steps. First you want to do the distinct count group by brand, then you can expand the result.
In the advanced editor, it should look like this:
#"Grouped Rows" = Table.Group(#"Changed Type", {"Brand"}, {{"Count", each Table.RowCount(Table.Distinct(_)), Int64.Type}, {"All", each _, type table [Brand=nullable text, Type=nullable text, Store=nullable text]}}),
#"Removed Columns" = Table.RemoveColumns(#"Grouped Rows",{"Brand"}),
#"Expanded All" = Table.ExpandTableColumn(#"Removed Columns", "All", {"Brand", "Type", "Store"}, {"Brand", "Type", "Store"})"All.Type", "All.Store"})
Cheers!
@amitchandak Could you please help resolving this either by DAX or Power Query?
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
72 | |
69 | |
55 | |
37 | |
35 |
User | Count |
---|---|
85 | |
66 | |
59 | |
46 | |
45 |