Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
DJKarma2
New Member

Logic Required for solving a date calculation problem

UnitReg IDDate

11231 jan 2023
11232342 jan 2023
123453453 jan 2023
1345453644 jan 2023
165534513 jan 2023
1456234315 jan 2023
1534534517 jan 2023
134329 jan 2023
1456348 feb 2023
1634639 feb 2023
2453451 jan 2023
2364562 jan 2023
22343 jan 2023
265345424 jan 2023
25346313 jan 2023
24623515 jan 2023
3235317 jan 2023
36329 jan 2023
352522358 feb 2023
335259 feb 2023


I have this table, I want to create a calculated column, that flags 1 if any date per id for any employee falls in 7 days later or after.
The output looks like this, if you notice, it should flag the sets of dates if they lie between 7 days of each other. i.e it should also handle sets.

Furthermore, it should work for individual ids, and not consider datediff between different IDs so I guess you can ignore the reg id column.

UnitReg IDDateFlag

11231 jan 20231
11232342 jan 20231
123453453 jan 20231
1345453644 jan 20231
165534513 jan 20231
1456234315 jan 20231
1534534517 jan 20231
134329 jan 20230
1456348 feb 20231
1634639 feb 20231
2453451 jan 20231
2364562 jan 20231
22343 jan 20231
265345424 jan 20231
25346313 jan 20231
24623515 jan 20231
3235317 jan 20231
36329 jan 20230
352522358 feb 20231
335259 feb 20231
1 REPLY 1
v-rongtiep-msft
Community Support
Community Support

Hi @DJKarma2 ,

I'm very sorry I have some questions. "flags 1 if any date per id for any employee falls in 7 days later or after." and "you can ignore the reg id column." According to the Unit column, Shouldn't it be these columns that output 1?

1 5345345 2023/1/17
1 343 2023/1/29
1 45634 2023/2/8
1 63463 2023/2/9

And why is the output of the next two lines 0?

1 343 2023/1/29 0
3 63 2023/1/29 0

 

How to Get Your Question Answered Quickly 

 

 please provide more details with your desired output (or some sample data) .

 

Best Regards
Community Support Team _ Polly

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.