gpt4 book ai didi

Power BI multiply row by row based on another table value (calculated)(基于另一个表值的Power BI逐行相乘(计算))

转载 作者:bug小助手 更新时间:2023-10-24 22:39:24 26 4
gpt4 key购买 nike



I am new to Power BI.

我是Power BI的新手。


I have a table (Purchases) that has two values that must be multiplied or divided, price and currency rate; based on people's choice. The calculations must be done row by row.

我有一个表(采购),其中有两个值必须相乘或相除,价格和汇率;基于人们的选择。计算必须逐行进行。


On excel, i have an options button for the choice and in my table Purchases i have column with a formula based on options cell value.

在EXCEL上,我有一个用于选择的选项按钮,在我的表Purchments中,我有一个列,其中包含一个基于选项单元格值的公式。


IF(cell options=1, price \* currency rate, price / currency rate)

Now, in Power BI, i created another table (Currency Choice), with the rows: mxn (value = 1) and usd (value = 2). I added an slicer so people can choose the price currency and this selections creates a Measure.

现在,在Power BI中,我创建了另一个表(Currency Choice),其中包含行:mxn(值=1)和U.S.(值=2)。我添加了一个切片器,这样人们就可以选择价格货币,这个选择创建了一个衡量标准。


I am trying to have my table Purchases multiply or divide each row based on the Currency Choice selection (Measure), it doesn't work.

我试图让我的表购买量根据货币选择(度量)乘以或除以每一行,但不起作用。


Any advice.

有什么建议吗。


Thanks.

谢谢。


Someone told me to add a custom column to my Purchases table in the Query Editor, but i cannot add a Measure.

有人告诉我在查询编辑器中将自定义列添加到我的Purchase表中,但我无法添加度量值。


Example Table Purchases:

表格购买示例:


Price   Rate    Currency
100 15 mxn
200 15 usd
100 15 mxn
500 15 mxn
400 15 usd

Example Table Currency Choice:

表货币选择示例:


Currency   Value
mxn 1
usd 2

If people pick usd, the Measure would be 2 so, i expect the rows to be like this:

如果人们选择美元,那么度量将是2,因此,我预计行将如下所示:


Price   Rate    Currency   New Price
100 15 mxn 6.66 (100/15)
200 15 usd 200
100 15 mxn 6.66 (100/15)
500 15 mxn 33.33
400 15 usd 400

更多回答
优秀答案推荐

you'd need an iterating function to retrieve the correct rate for each record.

您需要一个迭代函数来检索每个记录的正确率。


IF(
Test=True(),
SUMX('Table', [Amount] * RELATED([Rate]) ),
SUMX('Table', DIVIDE([Amount] , RELATED([Rate]))
)

更多回答

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com