powerpivot中的sumifs比率

发布于 2025-02-13 20:31:13 字数 843 浏览 0 评论 0原文

我在Excel中有一张表,利用电源枢轴,然后使用枢轴表显示/过滤。在我的数据集中,根据切片机在枢轴表中正确“总和”的功率枢轴内计算一个比率是可以的 - 这使用了sumx(成本)/sumx(总计),并且一切正常。总和正确,我的意思是,如果我基于区域/状态/产品/员工进一步分解数据集,那么所有这些行的比率百分比都正确总和。

根据一个月或几个月的范围对数据集进行过滤。此结果在一个月或几个月范围内都可以正常工作。我要做的是在我的枢轴表中,显示当前月的比率和一年的比例。我已经尝试用在网上找到的方程式困扰,但似乎没有什么可用。这包括以下尝试:

=计算([COST],[PRODUCTID] =“ 224594”)/计算([总计],[Productid] =“ 224594”)

= sumx(filter(all('tablename'),pathContains(pathcontains)( 'tablename'[ProduciD],较早('tableName'[productid]))),'tableName'[cost]) / sumx(filter(all('tablename'),pathcontains('tablename'[propartiD],productid','tableName'[productid'[productid'])),'tableName'[table])

我需要“ sumifs”来总和成本所有月份的产品a除以产品A的总和持续数月。我不想将产品ID中的代码硬编码到等式中,而只是总结该产品的所有以前记录,但我似乎无法使其工作。

有什么建议吗?

示例数据集

I have a table in Excel, utilizing Power Pivot that I then display/filter using a Pivot Table. Within my dataset, calculating a ratio within Power Pivot that "sums" correctly in the pivot table based on slicers is fine - this utilizes a SUMX(Cost)/SUMX(Total) and everything works fine. By sums correctly, I mean if I further break down the data set based on Region/State/Product/Employee, all those Rows sum up correctly for the ratio percentage.

The dataset is filtered based on a single month or range of months. The result of this works fine for either the single month or range of Months. What I'm trying to do is within my Pivot Table, show a current month ratio AND a year to date ratio. I've tried messing around with equations I've found online, but nothing seems to work. This includes the following attempts:

=CALCULATE([Cost],[ProductID]="224594")/CALCULATE([Total],[ProductID]="224594")

=SUMX (FILTER(ALL('TableName'),PATHCONTAINS ('TableName'[ProductID], EARLIER('TableName'[ProductID]))),'TableName'[Cost]) / SUMX(FILTER(ALL('TableName'),PATHCONTAINS('TableName'[ProductID], EARLIER ('TableName'[ProductID]))),'TableName'[Total])

I need the "sumifs" to sum the cost for Product A for all months divided by the sum of total for Product A for all months. I do not want to hard code in the the Product ID into the equation, but simply sum all previous records for that product, but I can't seem to get this to work.

Any suggestions?

Sample Data Set

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

双手揣兜 2025-02-20 20:31:13

我在列中使用了计算和过滤功能,而不是尝试以解决问题的方式使用它们。

I used the calculate and filter functions in a column instead of trying to use them in a measure, which fixed the problem.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文