Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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.
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])
Solved! Go to Solution.
@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] ) )
)
)
@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] ) )
)
)
Thanks for the help !!
User | Count |
---|---|
25 | |
12 | |
8 | |
6 | |
6 |
User | Count |
---|---|
26 | |
12 | |
11 | |
10 | |
6 |