Check your eligibility for this 50% exam voucher offer and join us for free live learning sessions to get prepared for Exam DP-700.
Get StartedDon't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.
Hi,
I have a problem that I cannot resolve.
here is my table:
Date | Student Name | Subject | Test Result |
08-Dec-23 | Amir A. | Math | 80 |
10-Dec-23 | Amir A. | Math | 90 |
05-Nov-23 | Baruch B. | History | 70 |
01-Dec-23 | Amir A. | Science | 65 |
01-Oct-23 | Baruch B. | Math | 92 |
1-Sep-23 | Baruch B. | Math | 85 |
I would like to have a column that indicates the last "Test Result" based on the Student Name and Subject.
for Amir A. - Math - I would like to get 90, because the test was done on Dec, 10th
for Baruch B. - Math - I would like to get 92
for Baruch B. - History - I would like to see 70
is this possible using a DAX in a column?
it's OK to get the number 90 for all rows of Amir A. , Math.
Thank you in advance,
Yuval
Solved! Go to Solution.
Create a new column and paste the following expression:
Note: Make sure to change 'Sheet1' to your table name.
@yuvalpi you can also do this
Measure =
VAR _grouping =
ALLEXCEPT ( 'Table 1', 'Table 1'[Student Name], 'Table 1'[Subject] ) //define GROUPBY columns here
VAR one =
CALCULATE ( MAX ( 'Table 1'[Date] ), _grouping ) // what is the max date by the above group
VAR two =
CALCULATE ( MAX ( 'Table 1'[Test Result] ), _grouping, 'Table 1'[Date] = one ) //what is the test result on max date partioned by grouping
RETURN
two
@yuvalpi you can also do this
Measure =
VAR _grouping =
ALLEXCEPT ( 'Table 1', 'Table 1'[Student Name], 'Table 1'[Subject] ) //define GROUPBY columns here
VAR one =
CALCULATE ( MAX ( 'Table 1'[Date] ), _grouping ) // what is the max date by the above group
VAR two =
CALCULATE ( MAX ( 'Table 1'[Test Result] ), _grouping, 'Table 1'[Date] = one ) //what is the test result on max date partioned by grouping
RETURN
two
Hi smpa01,
I tried your solution and it also works great!
much appreciated!
thank you,
Yuval
Hi Bibiano_Geraldo,
This is amazing!! thank you so much for you quick and proffessional help!
much appreciated,
Yuval
Create a new column and paste the following expression:
Note: Make sure to change 'Sheet1' to your table name.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Prices go up Feb. 11th.
Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.
User | Count |
---|---|
144 | |
75 | |
63 | |
51 | |
48 |
User | Count |
---|---|
211 | |
86 | |
64 | |
59 | |
56 |