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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
acbi
Frequent Visitor

Realizar soma dentro de um período especifico

acbi_0-1647989145989.png

A situação é a seguinte: tenho uma ordem de pedido para entregar até um determinado dia, porém esse pedido pode ser entregue por partes em vários dias. Preciso de uma função que me indique a % que foi entregue até a data limite. no exemplo a cima seria a soma da porcentagem entregue no dia 17 e no dia 20, desconsiderando-se a parte entregue no dia 27.

[Dt. saída esperada] e [qt. entrada] vem da mesma planilha "entradas", todas as demais vem da planilha "saidas"

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @acbi ,

 

Try this code.

Running Total Percentage = 
VAR _Deadline =
    CALCULATE ( MAX ( Outputs[Date] ), ALLEXCEPT ( Outputs, Outputs[OP + REF] ) )
VAR _RUNNING_TOTAL =
    CALCULATE (
        SUM ( Outputs[Output qt] ),
        FILTER (
            ALLEXCEPT ( Outputs, Outputs[OP + REF] ),
            Outputs[Date] <= MAX ( Outputs[Date] )
        )
    )
VAR _Percentage =
    DIVIDE ( _RUNNING_TOTAL, SUM ( Inputs[input qty] ) )
RETURN
    IF ( MAX ( Outputs[Date] ) = _Deadline, BLANK (), _Percentage )

Result is as below.

1.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.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @acbi ,

 

Try this code.

Running Total Percentage = 
VAR _Deadline =
    CALCULATE ( MAX ( Outputs[Date] ), ALLEXCEPT ( Outputs, Outputs[OP + REF] ) )
VAR _RUNNING_TOTAL =
    CALCULATE (
        SUM ( Outputs[Output qt] ),
        FILTER (
            ALLEXCEPT ( Outputs, Outputs[OP + REF] ),
            Outputs[Date] <= MAX ( Outputs[Date] )
        )
    )
VAR _Percentage =
    DIVIDE ( _RUNNING_TOTAL, SUM ( Inputs[input qty] ) )
RETURN
    IF ( MAX ( Outputs[Date] ) = _Deadline, BLANK (), _Percentage )

Result is as below.

1.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.

amitchandak
Super User
Super User

@acbi , As of now it seem % between [qt. entrada]  and [qt. saidas] 

 

divide( [qt. saidas] , [qt. entrada]  )

 

Can you provide exact raw data?

 


Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.