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

Employee promotion count

Hi,

 

I am trying to count the number of month that pass before an employee gets promoted. I use this calculated column to count the rows. The issue I have is that I would like for the counter to increase by one. In Jan-19 1, Feb-19 2 and so on until the promotion but right now is only counting.

 

 

MESES SIN CAMBIO DE PUESTO =
CALCULATE (
COUNTROWS ( EMPLEADO ),
FILTER (
EMPLEADO,
EMPLEADO[nro_documento] = EARLIER ( EMPLEADO[nro_documento] )
&& EMPLEADO[nombre_puesto] = EARLIER ( EMPLEADO[nombre_puesto] )
)
)
 
 
 
 

Please your help.

 

powerbi.PNG

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi,

 

I managed the formula

MESES SIN CAMBIO DE PUESTO =
CALCULATE (
COUNTROWS ( EMPLEADO ),
FILTER (
EMPLEADO,
EMPLEADO[nro_documento] = EARLIER ( EMPLEADO[nro_documento] )
&& EMPLEADO[nombre_puesto] = EARLIER ( EMPLEADO[nombre_puesto] )
&& EMPLEADO[Mes Año] >= EARLIER ( EMPLEADO[Mes Año] )
)
)

 Thanks for all the help 

View solution in original post

4 REPLIES 4
v-kelly-msft
Community Support
Community Support

Hi @Anonymous,

 

You can create a calulated column as below:

 

Column = 
var a =CALCULATE(COUNTROWS('EMPLEADO'),FILTER('EMPLEADO','EMPLEADO'[documento]=EARLIER(EMPLEADO[documento])&&'EMPLEADO'[nombre]<=EARLIER(EMPLEADO[nombre])&&'EMPLEADO'[status]<>"promoted"))
Return
a

 

And you will see:

Annotation 2020-04-27 142349.png

Here I didnt count in the row which marks "promoted",if you need to count this row in,just remove the criteria in the dax expression.

 

Or you can create a measure as below:

 

Measure = 
var a =CALCULATE(COUNTROWS('EMPLEADO'),FILTER(ALL('EMPLEADO'),'EMPLEADO'[documento]=SELECTEDVALUE(EMPLEADO[documento])&&'EMPLEADO'[nombre]<=SELECTEDVALUE(EMPLEADO[nombre])&&'EMPLEADO'[status]<>"promoted"))
Return
a

 

And you will see:

Annotation 2020-04-27 142723.png

Here is a sample .pbix file you can refer to.

 

Best Regards,
Kelly
Did I answer your question? Mark my post as a solution!
Anonymous
Not applicable

Hi @v-kelly-msft,

 

I am attaching a table with the expected result. The issue I have is that I don't have a column with the status of the change. That's why I have the calculated column that counts when the name of the position changes as a promotion. In Now it shows how it's working now, it counts all the rows with the same name of position. I would like to count it for each month until now.

 

nro_documentomes_añonombre_puestoCalculated ColumnNow
11/1/2020A11
12/1/2020B13
13/1/2020B23
14/1/2020B33
22/1/2020C12
23/1/2020C22
24/1/2020D11
33/1/2020E12
34/1/2020E22

 

Thanks for all the help.

Anonymous
Not applicable

Hi,

 

I managed the formula

MESES SIN CAMBIO DE PUESTO =
CALCULATE (
COUNTROWS ( EMPLEADO ),
FILTER (
EMPLEADO,
EMPLEADO[nro_documento] = EARLIER ( EMPLEADO[nro_documento] )
&& EMPLEADO[nombre_puesto] = EARLIER ( EMPLEADO[nombre_puesto] )
&& EMPLEADO[Mes Año] >= EARLIER ( EMPLEADO[Mes Año] )
)
)

 Thanks for all the help 

amitchandak
Super User
Super User

@Anonymous , It is very difficult without sample data.

Can you share sample data and sample output.

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.