Forum Discussion
DazExcel
Oct 07, 2023Copper Contributor
How to dynamically total/count across multiple columns of a dynamic array
Hi, I'm trying to create a dynamic column that will give me a count based on two columns of a dynamic array. So if I've got three products across four offices like this... I want to sh...
PeterBartholomew1
Oct 07, 2023Silver Contributor
You have been busy while I was having breakfast!
My formula was
= LET(
distinctCategories, SORT(UNIQUE(SalesTbl[[Office]:[Produce]]), {1,2}),
office, CHOOSECOLS(distinctCategories, 1),
product, CHOOSECOLS(distinctCategories, 2),
entries, COUNTIFS(SalesTbl[Office], office, SalesTbl[Produce], product),
sales, SUMIFS(SalesTbl[Sales], SalesTbl[Office], office, SalesTbl[Produce], product),
HSTACK(office, product, entries, sales)
)SergeiBaklan
Oct 07, 2023Diamond Contributor
Oh, yes, I was between breakfast and lunch. Plus you spent more time to generate friendly source table.