Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreNext up in the FabCon + SQLCon recap series: The roadmap for Microsoft SQL and Maximizing Developer experiences in Fabric. All sessions are available on-demand after the live show. Register now
Hi,
This is my table :
| Matricule | Beg_Date | Ending_Date | Reason | Type Abs | Dab_Abs | End_Abs | Duration | Dur_rk |
| S21095 | 08/02/2022 | 08/02/2022 | FORMATION | Consentie | 08/02/2022 | 10/02/2022 | 3 | Less 5 days |
| S21095 | 09/02/2022 | 09/02/2022 | FORMATION | Consentie | 08/02/2022 | 10/02/2022 | 3 | Less 5 days |
| S21095 | 10/02/2022 | 10/02/2022 | FORMATION | Consentie | 08/02/2022 | 10/02/2022 | 3 | Less 5 days |
| S21095 | 05/04/2022 | 05/04/2022 | ABSENCE NON PAYEE | Subie | 05/04/2022 | 05/04/2022 | 1 | Less 5 days |
| S21095 | 27/05/2022 | 27/05/2022 | CONGES | Consentie | 27/05/2022 | 27/05/2022 | 1 | Less 5 days |
| S21095 | 06/06/2022 | 06/06/2022 | CONGES | Consentie | 06/06/2022 | 06/06/2022 | 1 | Less 5 days |
My problem is due to the HR system sometimes for a Holiday period I can have many rows. I cannot do it on query !!
I would like to add these 4 columns in my table. SO when there is only 1 line it is ok, more I do not succeed to achieve this.
The code should read each row and look at the difference between the previous End Abs row value and the beg value of the active row. And if difference is 1 it is the same period etc.....
ANy help would be very appreciate !!
Solved! Go to Solution.
@JamesFR06 So, perhaps something like this, although this would not be 100% foolproof:
Dab_Abs Column =
VAR __Matricule = [Matricule]
VAR __Reason = [Reason]
VAR __TypeAbs = [Type Abs]
VAR __Table = FILTER( 'Table', [Matricule] = __Matricule && [Reason] = __Reason && [Type Abs] = __TypeAbs)
VAR __Resut = MINX( __Table, [Beg_Date] )
RETURN
__Result
End_Abs Column =
VAR __Matricule = [Matricule]
VAR __Reason = [Reason]
VAR __TypeAbs = [Type Abs]
VAR __Table = FILTER( 'Table', [Matricule] = __Matricule && [Reason] = __Reason && [Type Abs] = __TypeAbs)
VAR __Resut = MAXX( __Table, [Ending_Date] )
RETURN
__Result
Duration = ([End_Abs Column] - [Dab_Abs Column]) * 1.
Dur_rk = IF( [Duration] < 5, "Less 5 days", "5 day or more" )
@JamesFR06 So, perhaps something like this, although this would not be 100% foolproof:
Dab_Abs Column =
VAR __Matricule = [Matricule]
VAR __Reason = [Reason]
VAR __TypeAbs = [Type Abs]
VAR __Table = FILTER( 'Table', [Matricule] = __Matricule && [Reason] = __Reason && [Type Abs] = __TypeAbs)
VAR __Resut = MINX( __Table, [Beg_Date] )
RETURN
__Result
End_Abs Column =
VAR __Matricule = [Matricule]
VAR __Reason = [Reason]
VAR __TypeAbs = [Type Abs]
VAR __Table = FILTER( 'Table', [Matricule] = __Matricule && [Reason] = __Reason && [Type Abs] = __TypeAbs)
VAR __Resut = MAXX( __Table, [Ending_Date] )
RETURN
__Result
Duration = ([End_Abs Column] - [Dab_Abs Column]) * 1.
Dur_rk = IF( [Duration] < 5, "Less 5 days", "5 day or more" )
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.
| User | Count |
|---|---|
| 9 | |
| 6 | |
| 3 | |
| 2 | |
| 2 |
| User | Count |
|---|---|
| 21 | |
| 12 | |
| 9 | |
| 5 | |
| 5 |