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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

calculating seniority banking

I have table Fact_an

Code_produitCode_Gestionnaire_ProdID_DateFicheAgentNBANRef_Idbanking seniority
12531235604/01/202020011
8596965896505/01/202060021
2586396325806/01/2020180032
256321235607/01/2020540042
1253965896508/01/20201620052
859696325809/01/20204860015
258631235610/01/202014580035
25632965896511/01/202043740043
12531235604/01/201912318
8596965896505/01/201960028
2586396325806/01/2019180038
256321235607/01/201960048
1253965896508/01/201960057
859696325809/01/201960017
258631235610/01/201960037
25632965896511/01/201960047



banking seniority

banking seniorityName
1less than 1 year
2less than 2 year
3less than 3 year
4less than 4 year
5less than 5 year
6less than 6 year
7less than 7 year
8less 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 1
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

See solution in post below.

https://community.powerbi.com/t5/Desktop/calculating-seniority-banking/m-p/1078783

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.