Forum Discussion
Anonymous
6 years agoNot applicable
calculating seniority banking
I have table Fact_an
| Code_produit | Code_Gestionnaire_Prod | ID_DateFicheAgent | NBAN | Ref_Id | banking seniority |
| 1253 | 12356 | 04/01/2020 | 200 | 1 | 1 |
| 8596 | 9658965 | 05/01/2020 | 600 | 2 | 1 |
| 25863 | 963258 | 06/01/2020 | 1800 | 3 | 2 |
| 25632 | 12356 | 07/01/2020 | 5400 | 4 | 2 |
| 1253 | 9658965 | 08/01/2020 | 16200 | 5 | 2 |
| 8596 | 963258 | 09/01/2020 | 48600 | 1 | 5 |
| 25863 | 12356 | 10/01/2020 | 145800 | 3 | 5 |
| 25632 | 9658965 | 11/01/2020 | 437400 | 4 | 3 |
| 1253 | 12356 | 04/01/2019 | 123 | 1 | 8 |
| 8596 | 9658965 | 05/01/2019 | 600 | 2 | 8 |
| 25863 | 963258 | 06/01/2019 | 1800 | 3 | 8 |
| 25632 | 12356 | 07/01/2019 | 600 | 4 | 8 |
| 1253 | 9658965 | 08/01/2019 | 600 | 5 | 7 |
| 8596 | 963258 | 09/01/2019 | 600 | 1 | 7 |
| 25863 | 12356 | 10/01/2019 | 600 | 3 | 7 |
| 25632 | 9658965 | 11/01/2019 | 600 | 4 | 7 |
banking seniority
| banking seniority | Name |
| 1 | less than 1 year |
| 2 | less than 2 year |
| 3 | less than 3 year |
| 4 | less than 4 year |
| 5 | less than 5 year |
| 6 | less than 6 year |
| 7 | less than 7 year |
| 8 | less than 8 year |
I create a report and a new mausure AN. WHE A USER SELECT A YEAR AND A MONTH AND banking seniority, I need to calculate the count of the rows the last 12 of months banking seniority< banking seniority seelcted by the user
AN =
VAR a = SELECTEDVALUE(Dim_DateFicheAgent[ID_DateFicheAgent])
VAR b =SELECTEDVALUE('Seniority banking'[banking seniority])
RETURN
CALCULATE (
COUNTROWS(FILTER(Fact_AN;
(Fact_AN[banking seniority]<=b && NOT ISBLANK (Fact_AN[banking seniority]))));
DATESBETWEEN (
Dim_DateFicheAgent[ID_DateFicheAgent];
NEXTDAY ( SAMEPERIODLASTYEAR (LASTDATE ( Dim_DateFicheAgent[ID_DateFicheAgent] ) ));
LASTDATE ( Dim_DateFicheAgent[ID_DateFicheAgent] )
))it returns errors wrong values. I put an example of the report here https://drive.google.com/file/d/1Ja3NevOm6i80uuS6lKPpHIBYaNQ2jee2/view?usp=drivesdk
1 Reply
- v-chuncz-msft
Community Support
Anonymous
See solution in post below.
https://community.powerbi.com/t5/Desktop/calculating-seniority-banking/m-p/1078783