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

Lista dos mais recentes

Estou com uma dificuldade em listar as linhas mais recentes de uma tabela, estou usando essa fórmula, porem informar a quantidade de linhas a serem carregadas. Teria alguma outra que possa usar para calcular automaticamente as linhas mais recentes?

 

Fórmula: Table.MaxN([Dados], "concludedAt", 15 )

 

Dados: Tabela Agrupada

concluídoEm: Dados

15: Quantidade de linhas que uso como exemplo.

 

 

 

theusorla_0-1650893949262.png

 

 

 

1 ACCEPTED SOLUTION
theusorla
Frequent Visitor

Resolvi criando uma nova coluna com o formulário mais recente e após isso usei a seguinte formula:

Table.FindText([Dados], [Formulário_recente])

View solution in original post

4 REPLIES 4
theusorla
Frequent Visitor

Resolvi criando uma nova coluna com o formulário mais recente e após isso usei a seguinte formula:

Table.FindText([Dados], [Formulário_recente])
jennratten
Super User
Super User

This is how you can filter each grouped tables for the max N rows in the concludedAt column. 

BEFORE

jennratten_0-1650895856908.png

 

AFTER

jennratten_1-1650895869534.png

SCRIPT

let
    SampleForGroupedTables = Table.TransformColumnTypes(Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUTLRNzLVNzIwMlIwNLIyMCjIVYrViVYyQpVBSBijSCDpMEGRMEZImKJImEAlYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Column1 = _t, concludedAt = _t]),{{"Column1", Int64.Type}, {"concludedAt", type datetime}}),
    Source = #table(
        { "Date", "Data" },
        {
            { 461894, SampleForGroupedTables },
            { 463207, SampleForGroupedTables },
            { 463205, SampleForGroupedTables }        
        }
    ),
    FilterSubtables = Table.TransformColumns ( 
        Source,
        {
            "Data",
            (t) => Table.MaxN ( t, "concludedAt", 2 )
        }
    )
in
    FilterSubtables

 

jennratten
Super User
Super User

Please confirm what you are wanting to do.  Filter the table shown in the screenshot for the max n values in the first column? Filter each grouped table for the max n values in a column named concludedAt (Can you include a screenshot of one of these tables? Is concludedAt a date column, datetime, etc).  Are you wanting to do something else?  

unitId seria o codigo da unidade.

Dados seria os dados agrupados daquela unidade.

 

Dentro de "Dados" tem:

unitId: codigo da unidade

EvaluationId: Codigo do formulário

ConcludedAt: Data da conclusão

ItemId: Pergunta do formulário

Resposta: Resposta do ItemId

 

Um formulário pode ter n perguntas com n respostas.

 

Preciso listar para cada unidade o formulário, as perguntas e as respostas mais recentes.

 

Exemplo:

 

unitIdevaluationIdconcludedAtitemIdResposta
4618943544394125/04/20227006145Não
4618943544394125/04/20227006146Estava fechado
4618943544393024/04/20227006145Sim
4618943544391020/04/20227006145Sim

 

Preciso que ele liste somente o ultimo formulário aplicado que foi dia 25/04/2022 no codigo do formulário 35443941.

 

Usei a formula Table.MaxN([Dados], "evaluationId", aqui preciso que calcule automaticamente )

 

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.

Top Solution Authors
Top Kudoed Authors