I work on ssas tabular, I use live connexion to connect powerbi to the cube.
I have table Fact_an
banking seniority
Dim_produit
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 wrong results, how ccan I correct it? Any help will too much appreciated. I put a pbix file example here https://drive.google.com/file/d/1Ja3NevOm6i80uuS6lKPpHIBYaNQ2jee2/view?usp=drivesdk
My problem is for example when I choose seniority less than 5 year
Expected results
But what I get:
Which is wrong.





