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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Add cell value of multiple rows in same column

Hello,

 

Can someone throw some light on the implementation of the below scenario.

 

UIDValueExpected ResultFormula for Math
1100100=Value(1)
22020=Value(2)
3 120=Value(1)+Value(2)
4200200=Value(4)
5 320=Value(3)+Value(4)
6750750=Value(6)

 

Thanks in advance. 

12 REPLIES 12
Tahreem24
Super User
Super User

@Anonymous  Try this measure:

Formula =
VAR value1_ = CALCULATE(SUM(UIDTable[Value]),UIDTable[UID]=1)
VAR value2_ = CALCULATE(SUM(UIDTable[Value]),UIDTable[UID]=2)
VAR value3_ = CALCULATE(SUM(UIDTable[Value]),UIDTable[UID]=3)
VAR value4_ = CALCULATE(SUM(UIDTable[Value]),UIDTable[UID]=4)
VAR value5_ = CALCULATE(SUM(UIDTable[Value]),UIDTable[UID]=5)
VAR value6_ = CALCULATE(SUM(UIDTable[Value]),UIDTable[UID]=6)
RETURN SWITCH(MAX(UIDTable[UID]),
1, value1_,
2,value2_,
3, value1_+value2_,
4, value4_,
5, value3_+value4_,
6, value6_)
 
Capture.JPG
 
Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

Sorry to trouble you. Am I doing anything wrong here? I am unable to get the same value as you get.

 

Formula =
VAR value1_ = CALCULATE(SUM(TableZ[Value]),TableZ[UID]=1)
VAR value2_ = CALCULATE(SUM(TableZ[Value]),TableZ[UID]=2)
VAR value3_ = CALCULATE(SUM(TableZ[Value]),TableZ[UID]=3)
VAR value4_ = CALCULATE(SUM(TableZ[Value]),TableZ[UID]=4)
VAR value5_ = CALCULATE(SUM(TableZ[Value]),TableZ[UID]=5)
VAR value6_ = CALCULATE(SUM(TableZ[Value]),TableZ[UID]=6)
RETURN SWITCH(MAX(TableZ[UID]),
1, value1_,
2,value2_,
3, value1_+value2_,
4, value4_,
5, value3_+value4_,
6, value6_)

 

DiamondRain_0-1648207438754.png

 

 

 

@Anonymous  Create the measure not column.

 

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

If its a measure, I get the same values. 

 

DiamondRain_0-1648209988533.png

 

@Anonymous , what is the data type of UID? is it a numeric value or text ?

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

@Tahreem24 , 

UID is Whole Number 

Value is Whole Number.

@Anonymous But i am not getting any issue that;s why I attached with screen shot.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

@Tahreem24 , This is strange. Can you share the PBIX ?

@Anonymous I am attaching PBIX file for your reference.

 

Don't forget to give thumbs up and accept this as a solution if it helped you!!!

Please take a quick glance at newly created dashboards : Restaurant Management Dashboard , HR Analytics Report , Hotel Management Report, Sales Analysis Report , Fortune 500 Companies Analysis , Revenue Tracking Dashboard
Anonymous
Not applicable

@Tahreem24 , Thanks for the report. Understood what went wrong. I was having VALUE column in 'Dont Summarize', that should be in Summarize.

 

Besides, for UID=5, it should be Resultant(UID3)+UID4

 

jaideepnema
Solution Sage
Solution Sage

Hi @Anonymous ,

Create a calculated column like this

Expected Value = IF(ISBLANK(Data[Value]),CALCULATE(SUM(Data[Value]),Data[ID]<=EARLIER(Data[ID]),ALL(Data)),Data[Value])
 
Where data is the table name of your dataset being used
 

Please accept this as a solution if your question has been answered !!

Appreciate a Kudos 😀

Anonymous
Not applicable

Thanks for your efforts. 

I might have missed this. But, the summation is not always with EARLIER cell value or <= case.

 

It could beRow 3= Row1+Row2,

Row 9 = Row 2+Row7,

Row 10 = Row7+ Row9

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.