Starting December 3, join live sessions with database experts and the Microsoft product team to learn just how easy it is to get started
Learn moreGet certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now
Hello Experts,
I am trying to create calucated column using DAX Function where i am trying to subtract different subject score based on User ID.
I have three table, Table1 contain candidate User ID information, Table2 contain Score and Subject ID,and Table3 contain Subject name and Subject ID. Table structure are below :
Table1 | |
ID1 | User ID |
1 | A |
2 | B |
3 | C |
4 | D |
Table2 | ||
ID1 | Subject ID | Score |
1 | A1 | 23 |
2 | A2 | 34 |
2 | A1 | 21 |
1 | A2 | 43 |
1 | A3 | 32 |
Table3 | |
Subject ID | Subject |
A2 | English |
A1 | Maths |
A3 | Science |
A4 | History |
I am trying to create DAX Column below :
A | B | DAX Column | |
Maths | 23 | 21 | SQRT(23-21) |
English | 43 | 34 | SQRT(43-34) |
How can i create Calculated column (DAX Column)? Please Help
Thanks
Solved! Go to Solution.
Hi @shreyansh008 ,
You could refer to my sample for details.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @shreyansh008 ,
You could refer to my sample for details.
Best Regards,
Zoe Zhi
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I am not sure about the calculation you are trying to do and how you plan to visualize it. Assuming you have a 1:Many between Table 3 and Table 2, you could calculate the square root of the difference between the max and min score for each subject with this DAX expression:
SqrtMaxMin =
var maxscore = calculate(max(Table2[Score])
var minscore = calculate(min(Table2[Score])
var difference = maxscore-minscore
return sqrt(difference)
If that is not right, maybe you can adapt that to meet your needs. Note the the Calculate() is key to create context transition (i.e., use the Subject on Table 3 as a filter for the calculation on Table 2).
If this works for you, please mark it as the solution. Kudos are great too. Please let me know if it doesn't or if any questions.
Regards,
Pat
To learn more about Power BI, follow me on Twitter or subscribe on YouTube.
Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.
User | Count |
---|---|
27 | |
12 | |
11 | |
11 | |
9 |
User | Count |
---|---|
53 | |
30 | |
15 | |
14 | |
13 |