The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi , I need an assitance over the functions similar to Reverse Xlookup.
Two tables given and I want Rollno in table2 as per latest Date pick the roll no for the corresponding email. I need to add this function as calculated columns.
Table-1
Date | RollNO | |
12-04-2023 | priyanka.aura02@gmail.com | 23FMG01071 |
13-04-2023 | vinrajhealth@gmail.com | 23FMG03093 |
13-04-2023 | dusarivasavi@gmail.com | 23FMG02334 |
14-04-2023 | kalyani.pedapatnapu@gmail.com | 23 FMG02183 |
14-04-2023 | patukurirajeswari.2@gmail.com | 23FMG 04059 |
19-04-2023 | sunandachowdary09@gmail.com | 23FMG03152 |
17-04-2023 | priyanka.aura02@gmail.com | 23FMG04221 |
17-04-2023 | vinrajhealth@gmail.com | 23FMG04120 |
17-04-2023 | priyanka.aura02@gmail.com | 22FMG10082 |
17-04-2023 | priyanka.aura02@gmail.com | 23FMG01315 |
17-04-2023 | vinrajhealth@gmail.com | 23FMG03226 |
17-04-2023 | dusarivasavi@gmail.com | 22FMG12561 |
Table-2
RollNo | |
priyanka.aura02@gmail.com | 23FMG01315 |
vinrajhealth@gmail.com | |
dusarivasavi@gmail.com | |
kalyani.pedapatnapu@gmail.com | |
patukurirajeswari.2@gmail.com | |
sunandachowdary09@gmail.com |
Solved! Go to Solution.
@MR3110 - You have 3 different RollNo's for priyanka.aura02@gmail.com on the same date, so it is unclear what the criteria for choosing between them is. However, looking at your results, I'm going to assume you would like the last value for that date, in which case you need to add an Index column to Table1 in Power Query.
Transform Data >> Add Column >>Index Column >> From 1
After this your table will look like this:
Hit "close and apply", then you can add a calculated column to Table2 with the DAX below:
RollNo =
VAR _email = Table2[Email]
VAR max_date = CALCULATE( MAX( Table1[Date] ), Table1[Email] = _email)
VAR max_index = CALCULATE( MAX( Table1[Index] ), Table1[Email] = _email)
RETURN
CALCULATE( MAX( Table1[RollNO] ), Table1[Date] = max_date && Table1[Index] = max_index )
Evidence this works:
If this works for you, please accept as the solution so others can find it.
@MR3110 - You have 3 different RollNo's for priyanka.aura02@gmail.com on the same date, so it is unclear what the criteria for choosing between them is. However, looking at your results, I'm going to assume you would like the last value for that date, in which case you need to add an Index column to Table1 in Power Query.
Transform Data >> Add Column >>Index Column >> From 1
After this your table will look like this:
Hit "close and apply", then you can add a calculated column to Table2 with the DAX below:
RollNo =
VAR _email = Table2[Email]
VAR max_date = CALCULATE( MAX( Table1[Date] ), Table1[Email] = _email)
VAR max_index = CALCULATE( MAX( Table1[Index] ), Table1[Email] = _email)
RETURN
CALCULATE( MAX( Table1[RollNO] ), Table1[Date] = max_date && Table1[Index] = max_index )
Evidence this works:
If this works for you, please accept as the solution so others can find it.
Thank You, it works well
To achieve this in Excel, you can use a combination of the XLOOKUP and MAXIFS functions, or use FILTER in combination with INDEX and MATCH. Since you want to find the RollNo based on the latest date for each email in Table-2, here's a step-by-step guide:
Create a helper column in Table-1:
Find the latest Date for each Email:
Use XLOOKUP to find the RollNo for the latest Date:
Apply the formula to Table-2:
Assuming your columns are as follows:
You can use this formula in Table-2, Column B (RollNo):
This method will give you the latest RollNo for each email in Table-2 based on the most recent date from Table-1.
User | Count |
---|---|
11 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
24 | |
14 | |
13 | |
9 | |
8 |