To celebrate FabCon Vienna, we are offering 50% off select exams. Ends October 3rd. Request your discount now.
Hi,
I have 2 tables in which, I want to get total sum based on 5 columns. So I have tried with following formula it is throwing error.
EVALUTE(SUMMARIZECOLUMNS('TABLE1'[ORDER_NO],'TABLE1'[QUE_NO],'TABLE2'[QUE_NO],'TABLE2'[ID],'TABLE2'[CUST_ID],'TABLE1'[CUST_NAME],'TABLE1'[DATE],SUM('TABLE2'[SALES])
Please hlep me to do it.
Thanks,
AshDil
Solved! Go to Solution.
Hi @AshDil
Do you want to calculate the total based on many different columns in two tables?
There could be only one active relationship between two tables. Here I suggest you to create a Newkey columns in two tables for calculation.
NewKey are calculated columns.
NewKey = COMBINEVALUES(",",Table1[Order_no],Table1[Column2],Table1[Column3])
NewKey = COMBINEVALUES(",",Table2[Order_no],Table2[Column2],Table2[Column3])
Measure:
Total = SUMX(FILTER(ALL(Table2),Table2[NewKey] in VALUES(Table1[NewKey])),Table2[Value])
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @AshDil
Are you able to provide a little more detail about what you're wanting?
If you are after the Total Sum, you can use the measure "Total Sum = SUM ( 'TABLE2'[SALES] )"
From there, all you need to do is use a Table visual from the Visualizations pane, drag the columns you want in the Table, and then drag the measure "Total Sum" at the end of the table.
Just please make sure that you have a one to many relationship (single direction) from Table1 to Table2 using the [ORDER_NO] field as the relationship.
Hope that helps 🙂
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
Hi @TheoC ,
I have many to many relationship between table 1 and table 2.
So please guide me to achieve this.
Thanks,
AshDil
Hi @AshDil what is the unique ID in your Table 1 and what is the relationship between your Table 1 and Table 2?
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
Hi @TheoC ,
The unique column is Order_no, relation between table 1 and table 2 is many to many based on this column.
Thanks,
AshDil
Hi @AshDil
Okay, thanks for letting me know.
Now, all you need to do is use a Table visual from the Visualizations pane, drag the columns you want in the Table, and then drag the measure "Total Sum" at the end of the table.
Thanks heaps 🙂
If I have posted a response that resolves your question, please accept it as a solution to formally close the post.
Also, if you are as passionate about Power BI, DAX and data as I am, please feel free to reach out if you have any questions, queries, or if you simply want to connect and talk to another data geek!
Want to connect?www.linkedin.com/in/theoconias
Hi @TheoC ,
I want to show that value in KPI card, the total sum value must be based on the above mentioned columns.
Sorry for troubling,Please help me if any other way to resolve it.
Thanks,
AshDil
Hi @AshDil
Do you want to calculate the total based on many different columns in two tables?
There could be only one active relationship between two tables. Here I suggest you to create a Newkey columns in two tables for calculation.
NewKey are calculated columns.
NewKey = COMBINEVALUES(",",Table1[Order_no],Table1[Column2],Table1[Column3])
NewKey = COMBINEVALUES(",",Table2[Order_no],Table2[Column2],Table2[Column3])
Measure:
Total = SUMX(FILTER(ALL(Table2),Table2[NewKey] in VALUES(Table1[NewKey])),Table2[Value])
Result is as below.
Best Regards,
Rico Zhou
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.