Forum Discussion
Calculated column sum from other table based on other column value
Hi, I'll try to explain what I need.
I have a table which contains some target value. I would calculate a value based on other table depending on "Cd_CACda" column.
So, this is the calculated column formula
Allocazione_1 =
VAR ONF = CALCULATE(SUM(QUERY_CostiIndiretti[Importo]),TRIM(QUERY_CostiIndiretti[CentroAnalisi]) = "OF001")
RETURN
IF(Allocazione_Ordine[Cd_CACda] = "AMM001",VALUE(ONF),0)
and this is the table
Please try:
Allocazione_1 = VAR ONF = CALCULATE(SUM(QUERY_CostiIndiretti[Importo]), FILTER(ALL(QUERY_CostiIndiretti), QUERY_CostiIndiretti[CentroAnalisi] = "OF001")) RETURN IF(Allocazione_Ordine[Cd_CACda] = "AMM001",ONF,0)If the problem persists,could you share the sample pbix with dummy data?
Please remove any sensitive data before uploading.
3 Replies
- amitchandak
Super User
mespoKTM , is there a relation between the two tables?
Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.
you have get column from one table another like
refer 4 ways to copy data from one table to another
https://www.youtube.com/watch?v=Wu1mWxR23jU
https://www.youtube.com/watch?v=czNHt7UXIe8- mespoKTMRegular Visitor
Hi amitchandak , thank you for reply. There is a relationship through registry table.
For example: in the column "Allocazione_1" I want the sum of value related to "ONF001" from another table. The other table is this:
- V-lianl-msft
Community Support
Please try:
Allocazione_1 = VAR ONF = CALCULATE(SUM(QUERY_CostiIndiretti[Importo]), FILTER(ALL(QUERY_CostiIndiretti), QUERY_CostiIndiretti[CentroAnalisi] = "OF001")) RETURN IF(Allocazione_Ordine[Cd_CACda] = "AMM001",ONF,0)If the problem persists,could you share the sample pbix with dummy data?
Please remove any sensitive data before uploading.