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
lorran
Frequent Visitor

Contagem da linha mais recente por data

Boa tarde a todos Tenho uma lista contendo um historico de atualizações do quadro dos meus funcionarios atualmente Gostaria de saber uma regra que faria ser possivel um calculo que saiba me dizer pelo histórico quais funcionarios eu tinha em dados mais antigostendo que contar um Top 1 de cada chapa por dados, somando com como Top 1 anterior para saber os contratados reais.

7 REPLIES 7
lorran
Frequent Visitor

Alguém? 🙂 

lorran
Frequent Visitor

Bom dia, 

 

Entendi. Mas neste caso não deveria ser 2 o resultado de 2008. Preciso do total acumulado dos SITUACAO<>"D" ou seja ATIVOS "A", Mês a Mês e Ano a Ano. Para comparativo. Na forma que se encontra só tras os Ativos no Ano e não acumulado. 

 

Obrigado. 

lorran
Frequent Visitor

Link da planilha de exemplo: 

https://liveestacio-my.sharepoint.com/:x:/g/personal/201901058328_alunos_estacio_br/Edc1xzqf_UVPiES-...

Preciso fazer uma contagem Ano/ano mês/mês

Onde o sistema traga quantos funcionários eu tinha
na data que eu definir.

por exemplo o funcionário da chapa 4

Foi admitido 2007-10-19
Entrou de férias 2008-06-17
Voltou de férias 2008-07-17

Preciso que o sistema faça uma contagem que traga
Do período para trás a contagem de ATIVOS.

considerando a data 2008-07-31

ele tem que pegar a data de mudança mais recente da chapa 4
ou seja = NOVASITUACAO = A --- 2008-07-17

e não contar as outras duas que gerariam duplicidade.

trazendo um valor irreal.

Hi @lorran 

I think you want to show the latest update value for each employee in each code. And the NOVASITUACAO = A.

Try this measure:

 

Measure = 
VAR _SelectDate = SELECTEDVALUE('Date'[Date])
VAR _LastDataChange1 = CALCULATE(MAX('Sample'[DATAMUDANCA]),FILTER(ALL('Sample'),'Sample'[CODCOLIGADA] = MAX('Sample'[CODCOLIGADA])&&'Sample'[CHAPA] = MAX('Sample'[CHAPA])&&'Sample'[DATAMUDANCA]<=_SelectDate))
VAR _LastDataChange2 = CALCULATE(MAX('Sample'[DATAMUDANCA]),FILTER(ALL('Sample'),'Sample'[NOVASITUACAO]="A"&&'Sample'[CODCOLIGADA] = MAX('Sample'[CODCOLIGADA])&&'Sample'[CHAPA] = MAX('Sample'[CHAPA])&&'Sample'[DATAMUDANCA]<=_SelectDate))

RETURN
IF(MAX('Sample'[DATAMUDANCA]) = _LastDataChange2&&_LastDataChange1 = _LastDataChange2,1,0)

 

Build a table visual ,add this measure into filter field and set it to show items when value = 1.

Select 2008/07/31 in Slicer built by unrelated Date table. Result is as below.

1.png

If I have any misunderstanding in your calculate logic, please tell me.

 

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

 

 

Cara, Sensacional. Atende perfeitamente em meu filtro. 

 

Porém não sei se vai ser possível utilizar esta medida para criar um grafico comparativo ANO a ANO e Mês a Mês. 

 

Pois, aplicando esta regra em um grafico de colunas por exemplo, ele não consegue aplicar a medida. 

 

lorran_0-1626205652510.png

 

E eu precisaria de usar estes dados de uma forma mais maleavel como exemplo abaixo: 

 

lorran_1-1626205728910.png

 

Esta me ajudando muito já, muito obrigado.

 

 

 

 

Hi @lorran 

Do you want to build a clustered column chart to show the count of value meet the requirement above by year and month?

Try sumx function.

Measure 2 = SUMX('Sample',[Measure])

Measure in Measure2 is the filter measure. It will return 1 for values meet our requirement, so just sum it.

Result:

3.png

Best Regards,

Rico Zhou

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly. 

v-rzhou-msft
Community Support
Community Support

Hi @lorran 

I think you want to get Top1 for each plate. I build a sample and have a test.

1.png

Measure:

Rank for each Plate = 
VAR _T = SUMMARIZE(ALL(History),History[Plate],History[Employee],"Count",COUNT(History[Employee]))
VAR _T2 = ADDCOLUMNS(_T,"Rank",RANKX(FILTER(_T,[Plate] = EARLIER(History[Plate])),[Count],,DESC,Dense))
Return
MAXX(FILTER(_T2,[Plate] = MAX(History[Plate])&&[Employee] = MAX(History[Employee])),[Rank])

Add this measure into Filter field in the table visual and set it to show items when value =1.

1.png

If this reply still couldn't help you solve your problem, please share a sample with me by your Onedrive for Business and show me the result you want. This may make me easier to understand your requirement.

 

Best Regards,

Rico Zhou

 

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.