Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.
I have two tables. One with the hours of actual learning of the students (per month) and one with the expected learning of the student (per week). I would like to know how to calculate the difference between the two tables (Expected Learning - Actual Learning), but specifying the level which means that I would like this to happen for every month.
In other words, this should be something like this for each month:
Sum of weeks(Expected Learning) - Actual Learning
Please let me know if you need any other information.
Solved! Go to Solution.
Hi , @Fran1991cesco
According to your description, you want to calcuate the difference between the actual and expected learning. RIght?
Here are the steps you can refer to :
(1)This is my test data :
(2)We can click "New measure" to create two measures like this:
Expected Value = var _curdate= MIN('actual learning'[Date])
var _cur_stu=VALUES('actual learning'[Student])
var _expected_table = FILTER(ALLSELECTED('Expected Learning') , 'Expected Learning'[Student] in _cur_stu && YEAR('Expected Learning'[Date])=YEAR(_curdate) && MONTH('Expected Learning'[Date])=MONTH(_curdate))
return
SUMX(_expected_table,[Value])
Difference = [Expected Value] -SUM('actual learning'[Value])
(3)Then we can put the measures on the visual and we can meet your need:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Sorry for not being responsive earlier.
I tried to do what you suggested but it did not work @v-yueyunzh-msft.
The situation is more slightly more complicated that anticipated which is why I the solution is not yet working. I ma going to provide some screenshots (this might also answer your question @Ashish_Mathur )
If I use the formula you provided, I do not get the expected result.
Can you please help me @Ashish_Mathur and @v-yueyunzh-msft ?
Hi , @Fran1991cesco
Thanks for your quick response! Doe the data you provide, i think my dax is right. Why "a" Student in "2022/01" is -15?
In my thought, the actual is 15 and the expected is also 15 using my dax logic:
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Hi,
Share data in a format that can be pasted in an MS Excel file.
I will thanks for now
Hi,
Share some data (which can be pasted in an MS Excel file) and show the expected result.
Hi , @Fran1991cesco
According to your description, you want to calcuate the difference between the actual and expected learning. RIght?
Here are the steps you can refer to :
(1)This is my test data :
(2)We can click "New measure" to create two measures like this:
Expected Value = var _curdate= MIN('actual learning'[Date])
var _cur_stu=VALUES('actual learning'[Student])
var _expected_table = FILTER(ALLSELECTED('Expected Learning') , 'Expected Learning'[Student] in _cur_stu && YEAR('Expected Learning'[Date])=YEAR(_curdate) && MONTH('Expected Learning'[Date])=MONTH(_curdate))
return
SUMX(_expected_table,[Value])
Difference = [Expected Value] -SUM('actual learning'[Value])
(3)Then we can put the measures on the visual and we can meet your need:
If this method does not meet your needs, you can provide us with your special sample data and the desired output sample data in the form of tables, so that we can better help you solve the problem.
Thank you for your time and sharing, and thank you for your support and understanding of PowerBI!
Best Regards,
Aniya Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City
Check out the April 2024 Power BI update to learn about new features.
User | Count |
---|---|
109 | |
98 | |
77 | |
66 | |
54 |
User | Count |
---|---|
144 | |
104 | |
100 | |
86 | |
64 |