Forum Discussion
PowerRobots99
2 years agoHelper II
PowerQuery - Checking if values are present in previous report date
Hello Everyone,
Please refer .PBIX file - File
In power query, we have to find out if WO is present in previous reporting date, if present then it should give True else False
Is there any way to achive this ?
Input -
Output -
| Report Date | Report Week | WO# | Output_IsInPreviousReportDate? |
| 28-04-2024 | 18 | 1 | |
| 28-04-2024 | 18 | 2 | |
| 28-04-2024 | 18 | 3 | |
| 28-04-2024 | 18 | 4 | |
| 28-04-2024 | 18 | 5 | |
| 28-04-2024 | 18 | 6 | |
| 28-04-2024 | 18 | 7 | |
| 28-04-2024 | 18 | 8 | |
| 28-04-2024 | 18 | 9 | |
| 28-04-2024 | 18 | 10 | |
| 06-05-2024 | 19 | 1 | TRUE |
| 06-05-2024 | 19 | 2 | TRUE |
| 06-05-2024 | 19 | 3 | TRUE |
| 06-05-2024 | 19 | 12 | FALSE |
| 06-05-2024 | 19 | 17 | FALSE |
| 06-05-2024 | 19 | 6 | TRUE |
| 06-05-2024 | 19 | 89 | FALSE |
| 06-05-2024 | 19 | 8 | TRUE |
| 06-05-2024 | 19 | 15 | FALSE |
| 06-05-2024 | 19 | 18 | FALSE |
Do the following steps:
- Do a group by Report Date - All rows
- Add an index column starting in 1
- Expand all columns except for date
- Add a new column with the following code
if [Index] = 1 then null else if Table.RowCount( Table.SelectRows( Table.SelectRows(#"Expanded Count",(x) => x[Index] = [Index]-1) , (y) => y[#"WO#"] = [#"WO#"])) = 1 then true else falseFile attach.
1 Reply
- MFelixSuper User
Do the following steps:
- Do a group by Report Date - All rows
- Add an index column starting in 1
- Expand all columns except for date
- Add a new column with the following code
if [Index] = 1 then null else if Table.RowCount( Table.SelectRows( Table.SelectRows(#"Expanded Count",(x) => x[Index] = [Index]-1) , (y) => y[#"WO#"] = [#"WO#"])) = 1 then true else falseFile attach.