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

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
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.