Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I need to create 2 SUMIFS columns in Power Bi with multiple criteria. One column will be "Per Charge Per month" to find the total charges with "Sum of Charge Amount", "charge bucket", "Type", and "Delivery Month Column" columns as criteria. The other column will have the same criteria but instead of "Sum Of charge Amount" column it will be the "Number Of Containers" column.
I used to do this in excel by using the SUMIFS formula.
This is the SUMIFS Formula in the "Per Charge Per Month" Column
=SUMIFS($D$2:$D$11,$G$2:$G$11,G2,$B$2:$B$11,B2,$C$2:$C$11,C2)
This is the SUMIFS Formula in the "Container Per Month" Column
=SUMIFS($E$2:$E$11,$G$2:$G$11,G2,$B$2:$B$11,B2,$C$2:$C$11,C2)
I have tried to make these columns in Power BI but I can't even create a SUMIF calculated column with just 1 criteria. I used to formula below to try create a column that shows the total number of containers in each month. But it just shows the number of containers in that row. I don't even know how I would add more criteria. Any advice would be really appreciated!
SUMIF Container Per Month =
VAR vRowShippingMonth = 'Invoice Charges'[Shipping month]
Return
CALCULATE(
SUM('Invoice Charges'[Number of Containers]),
'Invoice Charges'[Shipping month] = vRowShippingMonth)
–
–
–
–
FILTER('Table',
EARLIER([Delivery Month]) = [Delivery Month] &&
EARLIER([Charge Bucket]) = [Charge Bucket]))
Container per month =
CALCULATE(
SUM([Number of containers]),
FILTER('Table',
EARLIER([Delivery Month]) = [Delivery Month] &&
EARLIER([Charge Bucket]) = [Charge Bucket]))
Produces the same results you show in your table.
Note that the filter for the month works because all of the dates are on the same day of the month (1). If that was not the case, you'd have to add a column that shows year and month, and filter on that.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.