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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
SBC
Helper III
Helper III

How to summation for paricular row in power bi

Hi,

 

How to do summation for a particular row in power bi 

Input data:

 

curveexpsuv
LX_qwr                12                        16
NS_MEX-24
NS_AOC10-34.56
NS_XTV-22.4022.42
AC_X1C-33.5222

 

we need to sum only which starts with NS_ and we need to show that total under NS_MEX,remaining curve should be show as it is without any change.

 

Expected output:

curveexpsuv
LX_qwr12                      16
NS_MEX-47.9213.86
NS_AOC       10-34.56
NS_XTV-22.4022.42
AC_X1C-33.5222

 

 

 

Thanks,

SBC

2 REPLIES 2
v-jingzhang
Community Support
Community Support

Hi @SBC 

 

Sorry the expected result -47.92 and 13.86 seem not correct according to your description. For curves starting with NS_,

exp: (-2)+10+(-22.40)=-14.4

suv: 4+(-34.56)+22.42=-8.14

 

If above results are the correct results you want, you can try my solution

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45W8omILywvUtJRMjQCEWZKsTrRSn7B8b6uEUC+LkjQBCbm6O8MUmMAkjA20TOFK44ICQMrNtIzAUmCaCOwnKNzfIShM1i9sZ6pEVhOKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [curve = _t, exp = _t, suv = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"curve", type text}, {"exp", type number}, {"suv", type number}}),
    
    /* replace values in exp and suv columns */
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type", each [exp], each if [curve] = "NS_MEX" then List.Sum(Table.SelectRows(#"Changed Type", each Text.StartsWith([curve], "NS_"))[exp]) else [exp],Replacer.ReplaceValue,{"exp"}),
    #"Replaced Value1" = Table.ReplaceValue(#"Replaced Value", each [suv], each if [curve] = "NS_MEX" then List.Sum(Table.SelectRows(#"Replaced Value", each Text.StartsWith([curve], "NS_"))[suv]) else [suv],Replacer.ReplaceValue,{"suv"})
in
    #"Replaced Value1"

vjingzhang_0-1678245449179.png

 

Best Regards,
Community Support Team _ Jing
If this post helps, please Accept it as Solution to help other members find it.

Hi @v-jingzhang ,

Thanks for reponsding, when i try to implement that logic in my power bi report taking lots of time to load the data.

is there alternate way to achieve this ? using DAX or something🙂

 

Thanks,

SBC

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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.

Top Solution Authors
Top Kudoed Authors