Forum Discussion
Help dax while adding column
- Anonymous1 year ago
Hi yamina ,
Please try following Dax formulars.
Min date = VAR CurrentIndex = 'Table'[Index] VAR PreviousDossier = MAXX(FILTER('Table', 'Table'[Index] = CurrentIndex -1), 'Table'[N_dossier_NUDOS]) VAR CurrentDossier = 'Table'[N_dossier_NUDOS] RETURN IF( PreviousDossier = CurrentDossier && CurrentDossier <> BLANK(), MINX(FILTER('Table', 'Table'[N_dossier_NUDOS] = CurrentDossier), 'Table'[Date_creation_DACRI]), BLANK() )Condition retour = VAR CurrentDossier = 'Table'[N_dossier_NUDOS] VAR CurrentIndex = 'Table'[Index] VAR FirstDossierIndex = MINX(FILTER('Table', 'Table'[N_dossier_NUDOS] = CurrentDossier),'Table'[Index]) VAR FirstDossierCreationDate = CALCULATE(SELECTEDVALUE('Table'[Date_creation_DACRI]), 'Table'[Index] = FirstDossierIndex , ALL()) VAR CurrentPresentation = 'Table'[N_prestation_RGOUV] VAR PreviousPresentation = MAXX(FILTER('Table', 'Table'[Index] = CurrentIndex -1), 'Table'[N_prestation_RGOUV]) RETURN IFERROR( IF( 'Table'[Date_creation_DACRI] - FirstDossierCreationDate >= 0 && 'Table'[Date_creation_DACRI] - FirstDossierCreationDate <= 30 && CurrentPresentation >= PreviousPresentation +1, "Retour dans les 30 jours", BLANK() ), BLANK() )The final result is as follows. Hopefully it will meet your needs.
Please see the attached pbix for reference.
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Sorry ,
I reformulate my request with more lines in the file. I would like to indicate for the same file number the return condition if the Presta number increases by at least 1 and if the creation date is within 30 days of the date of the 1st file
| Date_creation_DACRI | N_dossier_NUDOS | N_prestation_RGOUV | Min date | Condition retour |
| 10/04/2024 | 2003038 | 5 | =SI(ET(I1=I2; I2<>""); MIN(SI(I:I=I2; A:A)); "") | =SIERREUR(SI(ET(A2 - L2 >= 0; A2 - L2 <= 30; J2 >= J1 + 1); "Retour dans les 30 jours"; "");"") |
| 13/04/2024 | 29803685 | 2 | 13/04/2024 | Retour dans les 30 jours |
| 13/04/2024 | 29803685 | 3 | 13/04/2024 | Retour dans les 30 jours |
| 14/04/2024 | 29803685 | 4 | 13/04/2024 | Retour dans les 30 jours |
| 14/04/2024 | 29803685 | 5 | 13/04/2024 | Retour dans les 30 jours |
| 14/04/2024 | 29803685 | 6 | 13/04/2024 | Retour dans les 30 jours |
| 14/04/2024 | 29803685 | 7 | 13/04/2024 | Retour dans les 30 jours |
| 14/04/2024 | 29803685 | 8 | 13/04/2024 | Retour dans les 30 jours |
| 14/04/2024 | 29803685 | 9 | 13/04/2024 | Retour dans les 30 jours |
| 14/04/2024 | 29803685 | 10 | 13/04/2024 | Retour dans les 30 jours |
| 14/04/2024 | 29803685 | 11 | 13/04/2024 | Retour dans les 30 jours |
| 11/04/2024 | 37670929 | 3 | 11/04/2024 | Retour dans les 30 jours |
| 12/04/2024 | 38244974 | 12 | 08/04/2024 | Retour dans les 30 jours |
| 12/04/2024 | 47918139 | 3 | 12/04/2024 | Retour dans les 30 jours |
| 11/04/2024 | 48992688 | 14 | 11/04/2024 | Retour dans les 30 jours |
| 12/04/2024 | 48992688 | 15 | 11/04/2024 | Retour dans les 30 jours |
| 12/04/2024 | 48992688 | 16 | 11/04/2024 | Retour dans les 30 jours |
| 12/04/2024 | 48992688 | 18 | 11/04/2024 | Retour dans les 30 jours |
| 11/04/2024 | 51319279 | 11 | 10/04/2024 | Retour dans les 30 jours |
| 10/04/2024 | 51477461 | 6 | 09/04/2024 | Retour dans les 30 jours |
| 13/04/2024 | 51829240 | 4 | 10/04/2024 | Retour dans les 30 jours |
| 11/04/2024 | 53353783 | 4 | 09/04/2024 | Retour dans les 30 jours |
| 13/04/2024 | 53353783 | 5 | 09/04/2024 | Retour dans les 30 jours |
| 13/04/2024 | 54456236 | 5 | 09/04/2024 | Retour dans les 30 jours |
| 08/04/2024 | 54846145 | 4 | 08/04/2024 | Retour dans les 30 jours |
| 13/04/2024 | 54909754 | 5 | 09/04/2024 | Retour dans les 30 jours |
- Anonymous1 year agoNot applicable
Hi yamina ,
Please try following Dax formulars.
Min date = VAR CurrentIndex = 'Table'[Index] VAR PreviousDossier = MAXX(FILTER('Table', 'Table'[Index] = CurrentIndex -1), 'Table'[N_dossier_NUDOS]) VAR CurrentDossier = 'Table'[N_dossier_NUDOS] RETURN IF( PreviousDossier = CurrentDossier && CurrentDossier <> BLANK(), MINX(FILTER('Table', 'Table'[N_dossier_NUDOS] = CurrentDossier), 'Table'[Date_creation_DACRI]), BLANK() )Condition retour = VAR CurrentDossier = 'Table'[N_dossier_NUDOS] VAR CurrentIndex = 'Table'[Index] VAR FirstDossierIndex = MINX(FILTER('Table', 'Table'[N_dossier_NUDOS] = CurrentDossier),'Table'[Index]) VAR FirstDossierCreationDate = CALCULATE(SELECTEDVALUE('Table'[Date_creation_DACRI]), 'Table'[Index] = FirstDossierIndex , ALL()) VAR CurrentPresentation = 'Table'[N_prestation_RGOUV] VAR PreviousPresentation = MAXX(FILTER('Table', 'Table'[Index] = CurrentIndex -1), 'Table'[N_prestation_RGOUV]) RETURN IFERROR( IF( 'Table'[Date_creation_DACRI] - FirstDossierCreationDate >= 0 && 'Table'[Date_creation_DACRI] - FirstDossierCreationDate <= 30 && CurrentPresentation >= PreviousPresentation +1, "Retour dans les 30 jours", BLANK() ), BLANK() )The final result is as follows. Hopefully it will meet your needs.
Please see the attached pbix for reference.
Best Regards,
Dengliang Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.- yamina1 year ago
Helper I
Hello
As i understand I need to add an index column, but it takes a very long time because my table has 2 millions lines. so it is impossible. In addition I have to sort before the columns N_dossier_ num . and N_prestation_ RGOUV by asc. It is very heavy because my report use summarize table from an another semantic model. so I don't know how to simplify this.