powerpivot中的sumifs比率
我在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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我在列中使用了计算和过滤功能,而不是尝试以解决问题的方式使用它们。
I used the calculate and filter functions in a column instead of trying to use them in a measure, which fixed the problem.