Forum

Countifs in Power Q...
 
Notifications
Clear all

Countifs in Power Query

3 Posts
3 Users
0 Reactions
308 Views
(@ryanets)
Posts: 1
New Member
Topic starter
 

Hi all,

I've read some helpful posts about recreating COUNTIF in Power Query (Numbering grouped data power query) but I'm having trouble when it comes to having multiple conditions e.g. COUNTIFS

In the attached simplified example I have a list of tasks - each Task is in a span, which is in a Region. Because my data is at a task level but my reporting is at the span level I use COUNTIFS to create a Span Count column =(COUNTIFS($A$1:$A2,A2,$B$1:B2,B2)=1)+0

I would really appreciate any help on how I can achieve something similar in Power Query.

Thanks

 
Posted : 05/03/2021 9:28 pm
(@debaser)
Posts: 836
Member Moderator
 

It sounds to me like using a pivot table with a distinct count would do what you need without any need to create this specific column in the source data. What does your actual output need to look like?

 
Posted : 06/03/2021 5:12 am
(@mel)
Posts: 2
New Member
 

if I understand your problem correctly, you could group by both columns (Area and Span)

let
Quelle = Excel.CurrentWorkbook(){[Name="Tabelle1"]}[Content],
#"Gruppierte Zeilen" = Table.Group(Quelle, {"Area", "Span"}, {{"Count", each _, type table [Area=text, Span=number, Task=text]}}),
#"Hinzugefügter Index" = Table.AddIndexColumn(#"Gruppierte Zeilen", "Index", 1, 1, Int64.Type),
#"Erweiterte Count" = Table.ExpandTableColumn(#"Hinzugefügter Index", "Count", {"Task"})
in
#"Erweiterte Count"

Regards

Melanie

 
Posted : 06/03/2021 7:22 am
Share: