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
Anonymous
Not applicable

Sum Cummulative

Hello, i want to do a cummulative sum on the measure % diff portefeuille, but it dosent work for some reason. Here my formulas.
I start by calculating the sum of my gain/lost with the mesure  Montant profit nette CAD, then i calculate the previous day with the mesure 'Portefeuille - Ajustement' Previous Row (Discontinuous Dates) V3 , then with diff $ i calculate the diffrence in $ , then with 

 % diff portefeuille i get the % diff for each day and with the final measure Sum cummulative i want to add up all the diff portefeuille for a cummulative total. 
Capture d’écran 2021-11-02 224939.png
I expect that to work, but for some reason i got some wierd value in the last formula ... , thanks in advance for the help.

Sum cummulative

Calculate('Fx_Yahoo_Query_Stock Own W Qty Trade'[% diff portefeuille],
FILTER (
ALLSELECTED( ( 'Calendrier W/O' )),
'Calendrier W/O'[Date] <= MAX ( ( 'Calendrier W/O'[Date] ) )
)
)

 % diff portefeuille

% diff portefeuille =
'Fx_Yahoo_Query_Stock Own W Qty Trade'[Diff $] /ABS(['Portefeuille - Ajustement' Previous Row (
Discontinuous Dates) V3]
)

diff $

Diff $ = Mesure[Montant Profit nette CAD] - ['Portefeuille - Ajustement' Previous Row (Discontinuous Dates) V3]

'Portefeuille - Ajustement' Previous Row (Discontinuous Dates) V3 

'Portefeuille - Ajustement' Previous Row (Discontinuous Dates) V3 = 

VAR _CurrentDate =

SELECTEDVALUE( 'Fx_Yahoo_Query_Stock Own W Qty Trade'[Date] )

VAR _PreviousDate =

CALCULATE( MAX( 'Fx_Yahoo_Query_Stock Own W Qty Trade'[Date] ),

FILTER(

ALLSELECTED( 'Fx_Yahoo_Query_Stock Own W Qty Trade' ),

'Fx_Yahoo_Query_Stock Own W Qty Trade'[Date] < _CurrentDate ) )

VAR _Result =

CALCULATE( Mesure[Montant Profit nette CAD],ALL('Calendrier W/O'[Date]),




'Fx_Yahoo_Query_Stock Own W Qty Trade'[Date] = _PreviousDate

)

RETURN

IF(_Result = BLANK(),_Result+

CALCULATE(Mesure[Montant Profit nette CAD],FIRSTDATE('Fx_Yahoo_Query_Stock Own W Qty Trade'[Date])),_Result)

Montant profit nette CAD

Montant Profit nette CAD = 

SUM('Fx_Yahoo_Query_Stock Own W Qty Trade'[Gain/Perte])







1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

Calculate(sumx('Calendrier W/O'[Date]),[% diff portefeuille]),
FILTER (
ALLSELECTED( ( 'Calendrier W/O' )),
'Calendrier W/O'[Date] <= MAX ( ( 'Calendrier W/O'[Date] ) )
)
)

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try a measure like

 

Calculate(sumx('Calendrier W/O'[Date]),[% diff portefeuille]),
FILTER (
ALLSELECTED( ( 'Calendrier W/O' )),
'Calendrier W/O'[Date] <= MAX ( ( 'Calendrier W/O'[Date] ) )
)
)

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
Anonymous
Not applicable

Thanks for the help !! 

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.