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.
Greetings guys,
I have two tables that I am using as a database.
Table 1
Month | Score1 |
2 | 10 |
3 | 20 |
4 | 30 |
5 | 40 |
6 | 50 |
Table2
Month | Score2 |
3 | 100 |
4 | 100 |
5 | 100 |
6 | 100 |
7 | 100 |
I created 2 measures using SUM to get the Score value, but when I do SumScore1 + SumScore2, it sums the values of the same months. Nothing new so far.
But what I need is for the values in table 1 to be sum to the values in table 2, considering the following month.
Month | Score1 | Score2 | SUM |
2 | 10 | 0 | 0 |
3 | 20 | 100 | 110 |
4 | 30 | 100 | 120 |
5 | 40 | 100 | 130 |
6 | 50 | 100 | 140 |
7 | 0 | 100 | 150 |
How can I do this?
Best Regards,
Solved! Go to Solution.
Hi @Anonymous
I think you can add a new Month table contains month from two tables. Then use LOOKUPVALUE dax to add another two columns from Table 1 and Table 2 .
Score1 = LOOKUPVALUE(Table1[Score1],Table1[Month],'Month'[Month])
Score2 = LOOKUPVALUE(Table2[Score2],Table2[Month],'Month'[Month])
Then create a calculated column to sum score1 and score2
sum = CALCULATE(MAX('Month'[Score1]),FILTER('Month','Month'[Month]<EARLIER('Month'[Month])))+'Month'[Score2]+0
The effect is as shown:
Best Regards
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi @Anonymous
I think you can add a new Month table contains month from two tables. Then use LOOKUPVALUE dax to add another two columns from Table 1 and Table 2 .
Score1 = LOOKUPVALUE(Table1[Score1],Table1[Month],'Month'[Month])
Score2 = LOOKUPVALUE(Table2[Score2],Table2[Month],'Month'[Month])
Then create a calculated column to sum score1 and score2
sum = CALCULATE(MAX('Month'[Score1]),FILTER('Month','Month'[Month]<EARLIER('Month'[Month])))+'Month'[Score2]+0
The effect is as shown:
Best Regards
Community Support Team _ Ailsa Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi, @Anonymous
Please check the sample pbix file's link down below if that is what you are looking for.
Sums =
VAR currentmonth =
MAX ( Months[Month] )
RETURN
SUM ( Table2[Score2] )
+ CALCULATE ( SUM ( Table1[Score1] ), Months[Month] = currentmonth - 1 )
https://www.dropbox.com/s/4jltqdi0usdj4lc/gdalpai%202021%200407.pbix?dl=0
Hi, My name is Jihwan Kim.
If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
@Anonymous , You need to create a common month table and join both tables with that and then analyze data using the month in the new table
Video: https://www.youtube.com/watch?v=Bkf35Roman8
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 |