Forum Discussion
AndreasMEG
2 years agoFrequent Visitor
Countifs
I need a power query custom column formula like the one shown in excel Can somebody help? :=) Its should count if its the same mRID and month
- 2 years ago
- Prepare your table to this format:
2. Name your Query i.e. MyData (without spaces and special characters)
3. Create blank query, open advanced editor, select whole code and replace it with the code I provided above.
4. Close Advanced Editor
5. Select Source Step from right panel Query Settings
6. Delete whole code of Source step (as you can see selected in the picture in Note below in my signature) and write there = MyData (which is your table reference)
AndreasMEG
2 years agoFrequent Visitor
Makes sence, perfect! Thank you so much! 😄
I changed the code a tiny bit (mRID - to text.type)
let
Source = MyData,
ChangedType = Table.TransformColumnTypes(Source,{{"Date", type date}, {"Budget", Currency.Type}, {"mRID", Text.Type}}, "sk-SK"),
GroupedRows = Table.Group(ChangedType, {"Date", "mRID"}, {{"Count", each Table.RowCount(_), Int64.Type}, {"All", each _, type table}}),
ExpandedAll = Table.ExpandTableColumn(GroupedRows, "All", {"Budget"}, {"Budget"})
in
ExpandedAll- dufoq32 years agoCommunity Champion
You're welcome.