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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Accumulate Negative Values

Hi all !!

 

I need to make a pareto chart but with negative values, for this I need to accumulate the negative values from higher to lower.

 

The first step is to rank the negative totals from highest to lowest:

Rank Negative = RANKX(ALL(D_Stores[id_store]);[Negative Total])
 
The next step is to accumulate all the negative values from highest to lowest and this is where I have the problem, what do you recommend I do?
 
If they were positive values it would be as follows:
Pareto Value =  SUMX(TOPN([Rank Positive];ALL(D_Stores[id_store]);[Total Positive]);[Total Positive])
This case doesn't work for negative values.
 
Thanks!
Regards!
 
1 ACCEPTED SOLUTION
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Thanks for your feedback.

Based on your details, I modified my sample and the measures:

Use below measure to calculate the rankx :

 

Rankx = RANKX(ALL('Sample'),[ValuesMeasure],,DESC)

 

Then use the below measure to generate the cumulative results:

 

FinalResults = var a = [Rankx]
Return 
SUMX(FILTER(ALL('Sample'),[Rankx]<=a),[ValuesMeasure])

 

08.PNG

Community Support Team _ Dina Ye
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

6 REPLIES 6
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Thanks for your feedback.

Based on your details, I modified my sample and the measures:

Use below measure to calculate the rankx :

 

Rankx = RANKX(ALL('Sample'),[ValuesMeasure],,DESC)

 

Then use the below measure to generate the cumulative results:

 

FinalResults = var a = [Rankx]
Return 
SUMX(FILTER(ALL('Sample'),[Rankx]<=a),[ValuesMeasure])

 

08.PNG

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
v-diye-msft
Community Support
Community Support

Hi @Anonymous 

 

Please let me know if you'd like to get below results:

1. simple table below:

02.PNG

2. Add rank column:

Rank = RANKX('Sample',[Values],,DESC)

03.PNG

3. Add the measure:

Measure 4 = CALCULATE(SUM('Sample'[Values]),FILTER(ALL('Sample'),[Rank]<=MAX('Sample'[Rank])))

04.PNG

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
Anonymous
Not applicable

Hi @v-diye-msft !

Thank you for your reply ! In this case it doesn't work.

 

The problem is this:
The columns "Values Negative" and "Rank" are two measures, so I couldn't use the last MAX of your measure.

 

Values Negatives = CALCULATE ( [TOTAL]; FILTER ( D_Store; [TOTAL] < 0 ) )
Rank = RANKX(ALL(D_Store[store id]);[Values Negatives];;ASC)

 

3.JPG

 

What I need is to create a measure that accumulates the negative values from ranking 1 to the last.

For example the "New Measure":

 

4.JPG

 

Regards!

Anonymous
Not applicable

Try this:
Measure =
VAR LastVisible = MAX ( TABLE[Rank] )
RETURN CALCULATE (
SUM(VALUES),
TABLE[RANK] <= LastMonthVisible
Anonymous
Not applicable

Hi @Anonymous is not possible because rank is a measure, it is not stored in a table.

 

 

Anonymous
Not applicable

Instead of a measure, you can create a calculated column for the same.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.