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

Saldo acumulado ::: running

olá

quero calcular o saldo acumulado, da seguinte tabela (V ACUMULADO):

V LIQUIDOV ACUMULADO
-36 900 000 €-36 900 000 €
-57 300 000 €-94 200 000 €
-61 500 000 €-155 700 000 €
18 900 000 €-136 800 000 €
-57 000 000 €-193 800 000 €
-15 900 000 €-209 700 000 €
-23 700 000 €-233 400 000 €
-45 900 000 €-279 300 000 €
-47 400 000 €-326 700 000 €
-11 400 000 €-338 100 000 €
-48 300 000 €-386 400 000 €
30 600 000 €-355 800 000 €

 

V Liquido é uma medida que determinar o valor liquido, quero agora criar outra medida para acumular o V Liquido todos os meses.. 

 

2 ACCEPTED SOLUTIONS
v-zhangti
Community Support
Community Support

Hi, @Paulo123 

 

I simulated some of the data hoping to restore your problem.

vzhangti_0-1643083464181.png

Measure:

V LIQUIDO = CALCULATE(SUM('Table'[Sales]))
V ACUMULADO = 
CALCULATE (
    SUMX ( VALUES ( 'Table'[Date] ), [V LIQUIDO] ),
    FILTER ( ALLSELECTED ( 'Table' ), [Date] <= MAX ( 'Table'[Date] ) ))

vzhangti_1-1643083534857.png

 

Best Regards,

Community Support Team _Charlotte

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

Paulo123
Frequent Visitor

hi,

how do I limit the sum period, for example accumulate only 3 previous periods

View solution in original post

7 REPLIES 7
Paulo123
Frequent Visitor

hi,

how do I limit the sum period, for example accumulate only 3 previous periods

Hi, @Paulo123 

 

Measure:

Measure = 
Var N1=SUMMARIZE(filter(ALL('Table'),[Date]<=MAX('Table'[Date])),[Date],"Sum",SUM('Table'[Sales]))
Var N2=TOPN(3,N1,[Date],DESC)
Return
SUMX(N2,[Sum])

vzhangti_0-1643188427134.png

 

Best Regards,

Community Support Team _Charlotte

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

v-zhangti
Community Support
Community Support

Hi, @Paulo123 

 

I simulated some of the data hoping to restore your problem.

vzhangti_0-1643083464181.png

Measure:

V LIQUIDO = CALCULATE(SUM('Table'[Sales]))
V ACUMULADO = 
CALCULATE (
    SUMX ( VALUES ( 'Table'[Date] ), [V LIQUIDO] ),
    FILTER ( ALLSELECTED ( 'Table' ), [Date] <= MAX ( 'Table'[Date] ) ))

vzhangti_1-1643083534857.png

 

Best Regards,

Community Support Team _Charlotte

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

 

Paulo123
Frequent Visitor

olá,

tentei aplicar os dois modelos, mas deparei com o mesmo problema em ambos os casos, diz que este parametro não é correto:

CALCULATE(SUM([V LIQUIDO].
O V LIQUIDO já é uma medida.
 
 

olá,

você precisa de referência de tabela:

[V Liquido YTD]=CALCULATE(SUM('Tabela'[V Liquido]),DATESYTD('calendário'[Date]))

[acumular o V Liquido] = var _date =MAX('calendário'[Date]) return
CALCULATE(SUM('Tabela'[V Liquido]),ALL(calendário),calendário'[Date]<=_date)






Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




ValtteriN
Super User
Super User

Olá,

por YTD:

[V Liquido YTD]=CALCULATE(SUM('Table'[V Liquido]),DATESYTD('Calendar'[Date]))

por acumular:
[acumular o V Liquido] = var _date =MAX('Calendar'[Date]) return
CALCULATE(SUM('Table'[V Liquido]),ALL(Calendar),Calendar'[Date]<=_date)







Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




goncalogeraldes
Super User
Super User

Hello @Paulo123, you can try the following and check if it works for you:

Cumulative Measure =
VAR _min =
    MIN ( DimDate[Datekey] )
VAR _max =
    CALCULATE ( MAX ( Sales[DateKey] ), ALL ( Sales ) )
VAR _sales =
    CALCULATE (
        SUM(Sales[Amount]),
        FILTER (
            ALL ( DimDate[Datekey] ),
            DimDate[Datekey] <= MAX ( ( DimDate[Datekey] ) )
        )
    )
RETURN
    IF ( _min <= _max, _sales, 0 )

Hope this answer solves your problem!
If you need any additional help please @ me in your reply.
If my reply provided you with a solution, please consider marking it as a solution ✔️ or giving it a kudoe 👍
Thanks!

You can also check out my LinkedIn!

Best regards,
Gonçalo Geraldes

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.