Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi There,
I am trying to create a calculated measure where i am taking difference from two columns(one is calculated measure and one is calculated column) which is avaiable in two different tables and they have Many to Many relationship .
| Product | Table A (Amount in Rs) | Table B (Amount in Rs) | Difference |
| Bag | 100 | 400 | 300 |
| Bat | 200 | 100 | -100 |
Desrire Result i am looking for is column name "Difference"
Can anyone help me how to achieve this ??
Thanks ,
Ashish
Solved! Go to Solution.
Hi @Anonymous ,
Refer the below:
sumtablea = CALCULATE(SUM(TableA[value]),ALLEXCEPT(TableA,TableA[Product]))
sunmtableb = calculate(SUM(TableB[value]),ALLEXCEPT(TableB,TableB[Product]))
Relationship:
Difference:
Difference = [sumtablea]-LOOKUPVALUE(TableB[sunmtableb],TableB[Product],MAX(TableA[Product]))
Outputresult:
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
Hi @Anonymous ,
Refer the below:
sumtablea = CALCULATE(SUM(TableA[value]),ALLEXCEPT(TableA,TableA[Product]))
sunmtableb = calculate(SUM(TableB[value]),ALLEXCEPT(TableB,TableB[Product]))
Relationship:
Difference:
Difference = [sumtablea]-LOOKUPVALUE(TableB[sunmtableb],TableB[Product],MAX(TableA[Product]))
Outputresult:
Did I answer your question? Mark my post as a solution!
Best Regards
Lucien
Hi Lucien,
Thank you so much for your support. I tried and i got the result .
I appreicate your help.
Regards,
Ashish
@Anonymous use the same process that you do to create a calculated column and a measure
1. first create a calculated columns
2. create your first measure
3. then create your measure to calc difference between 1. calculated column 2. measure
in case you face any challenge, please sample data to create above calc
Proud to be a Super User!
Hi @negi007,
I tried creating the same but nothing is working out.
It gives error "a table of multiple values was supplied where a single value was expected" when i used Lookup value fucntion to call Calculated COlumn value inn Table 1.
Can you please elaborate some more?
Thanks.
A
@Anonymous why do you need to use lookup function. both tables are already linked to each other through relationship you have created as mentioned by you.
let say you first create a calculated column like
Proud to be a Super User!
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Experience the highlights from FabCon & SQLCon, available live and on-demand starting April 14th.
| User | Count |
|---|---|
| 47 | |
| 44 | |
| 40 | |
| 20 | |
| 15 |
| User | Count |
|---|---|
| 70 | |
| 68 | |
| 32 | |
| 27 | |
| 25 |