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

Create a progressive SUM that is dependent from another column

Hi all,

My problem is:

I created a Table with the look of Power BI.
In it, I put a column called 'Label' and a measure called 'Value' which gives me the total value.
The 'Label' data and the values obtained by the 'Amount' measure come from different tables.

What I want:

Create a measure that gives me, per line, the sum of the previous lines, as shown in this table.
When the value of the table or ranking is the smallest, it displays BLANK()

LabelRankAmountProgressive SUM
United Stated150000193000
Austalia240000143000
UK338000103000
Germany43500065000
France530000Blank()


Thanks for your help.

 

1 ACCEPTED SOLUTION
Nathaniel_C
Super User
Super User

@Anonymous try this 

Nathaniel_C_0-1638303643691.png

 



 

 

Progressive sum = 
VAR _MaxRank =
    CALCULATE ( MAX ( Rank1[Rank] ), ALL () )
/*VAR _calc =
    CALCULATE (
        MIN ( Rank1[Amount] ),
        FILTER ( ALL ( Rank1 ), Rank1[Rank] = _MaxRank )
    )*/
VAR _getRank =
    MAX ( Rank1[Rank] )
VAR _rt =
    CALCULATE (
        SUM ( Rank1[Amount] ),
        FILTER ( ALL ( Rank1 ), Rank1[Rank] >= _getRank )
    )
RETURN
    IF ( MAX ( Rank1[rank] ) = _MaxRank, "Blank()", _rt )

 

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





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

Proud to be a Super User!




View solution in original post

2 REPLIES 2
VahidDM
Super User
Super User

Hi @Anonymous 

 

Try this:

Measure = 
Var _M = CALCULATE(max('Table'[Rank]),all('Table'))
Var _A = CALCULATE(sum('Table'[Amount]),filter(all('Table'),'Table'[Rank]>=max('Table'[Rank])))
return
if(MAX('Table'[Rank])=_M,BLANK(),_A)

 

Output:

VahidDM_0-1638311647844.png

 

 

If this post helps, please consider accepting it as the solution to help the other members find it more quickly.
Appreciate your Kudos!!
LinkedIn: 
www.linkedin.com/in/vahid-dm/

 

 

Nathaniel_C
Super User
Super User

@Anonymous try this 

Nathaniel_C_0-1638303643691.png

 



 

 

Progressive sum = 
VAR _MaxRank =
    CALCULATE ( MAX ( Rank1[Rank] ), ALL () )
/*VAR _calc =
    CALCULATE (
        MIN ( Rank1[Amount] ),
        FILTER ( ALL ( Rank1 ), Rank1[Rank] = _MaxRank )
    )*/
VAR _getRank =
    MAX ( Rank1[Rank] )
VAR _rt =
    CALCULATE (
        SUM ( Rank1[Amount] ),
        FILTER ( ALL ( Rank1 ), Rank1[Rank] >= _getRank )
    )
RETURN
    IF ( MAX ( Rank1[rank] ) = _MaxRank, "Blank()", _rt )

 

 


Let me know if you have any questions.

If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos 👍are nice too.
Nathaniel





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

Proud to be a Super User!




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.

Top Solution Authors