动态计算基于Slicer-Powerbi的差异列

发布于 2025-02-13 07:20:21 字数 1407 浏览 1 评论 0原文

我有一个带有季度数量数据的桌子,还有一个切片机,可让您选择要查看每码的四分之一/年。切片机具有2019Q1至2021Q4的选择。我需要创建动态差异列,该列将根据切片机中选择的四分之一/年进行调整。我知道我需要使用计算/过滤器来创建一个新的措施,但是是PowerBi的初学者,并且不确定如何编写该公式。

Example of raw table data:

Code2019Q12019Q22019Q32019Q2020Q12020Q22020Q32020Q4
111112322832891922228328919
2222211748123131232286219
11111232397944442325530188
22222117411151423228325189

示例如果2019Q1和选择2020Q1:

代码2019Q12020Q1差异
1111123222210
22222117481-364
11111232397-165
22222117411-294

I have a table with quarterly volume data, and a slicer that allows you to choose what quarter/year you want to see volume per code for. The slicer has 2019Q1 through 2021Q4 selections. I need to create dynamic difference column that will adjust depending on what quarter/year is selected in the slicer. I know I need to create a new measure using Calculate/filter but am a beginner in PowerBI and am unsure how to write that formula.

Example of raw table data:

Code2019Q12019Q22019Q32019Q2020Q12020Q22020Q32020Q4
111112322832891922228328919
2222211748123131232286219
11111232397944442325530188
22222117411151423228325189

Example if 2019Q1 and 2020Q1 are selected:

Code2019Q12020Q1Difference
1111123222210
22222117481-364
11111232397-165
22222117411-294

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

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

发布评论

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

评论(1

明天过后 2025-02-20 07:20:21

Power BI不起作用。这是一个Excel Pivot表设置。您没有任何参数可以区分第一,第三或第二行。它们具有相同的代码,因此Power BI将汇总其量。您可以引入一个隐藏的索引列,但是为什么不只是坚持Excel呢?问题的功率bi批准是将表格(堆叠)到代码,四分之一和卷列,为Minuend和Subtrahend创建2个独立的切片机表,然后根据2个切片机的选定值来计算您的汇总差异。

Power BI doesn't work that way. This is an Excel pivot table setup. You don't have any parameter to distinguish first and third or second and fourth row. They have the same code, so Power BI will aggregate their volumes. You could introduce a hidden index column but then why don't you simply stick to Excel? The Power BI approch to the problem would be to unpivot (stack) your table to a Code, Quarter and a Volume column, create 2 independent slicer tables for Minuend and Subtrahend and then CALCULATE your aggregated differences based on the SELECTEDVALUE of the 2 slicers.

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