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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
dshah12
Helper II
Helper II

Iterate the values and do automate calculation

 

In the below table I want that if it has string (P) (MFA) it should do the sum and put that value in the (M) (MFA) actual and should eliminate counting the (M) (RR) 

such that new values should be  (Table wanted)

Applica noTitleActualForecast
1(M) (MFA) BA MOU (P)10,600400000000

 

The old table :-

Applica noTitleActualForecast
1(M) (MFA) BA MOU (P) 400000000
2(P) (MFA)  BA  MOU - PLL 5000 
3(P) (MFA)  BA  MOU - PLA5600 
4(M) (RR) BCA6000 
2 REPLIES 2
v-yohua-msft
Community Support
Community Support

Hi, @dshah12
Based on the information you gave, I have created a table

vyohuamsft_0-1705282382081.png

 

Please follow these steps:

 

  1. Create a new column and named  Actual

 

vyohuamsft_1-1705282382084.png

 

 

 

  1. Then use the following DAX expression.

 

Actual =

IF('Table'[Title] = "(M) (MFA) BA MOU (P)",

CALCULATE(SUM('Table'[value]),

FILTER('Table', CONTAINSSTRING('Table'[Title],"(P) (MFA)")

)))

 

1.png

 

 

How to Get Your Question Answered Quickly 

If it does not help, please provide more details with your desired output and pbix file without privacy information (or some sample data) .

Best Regards

Yongkang Hua

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

lbendlin
Super User
Super User

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMlTSUdLw1VTQ8HVz1FRwclTw9Q9V0AjQBAorALGJARQoxepEKxmBFAfAFINUg5XrKgT4+IBUm4IUgjSCFBvjVuwIUmuGpNYE5oqgIKAjnEHyZnCzYgE=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Applica no" = _t, Title = _t, Actual = _t, Forecast = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Actual", Currency.Type}, {"Forecast", Currency.Type}}),
    #"Filtered Rows" = Table.SelectRows(#"Changed Type", each not Text.Contains([Title], "(M) (RR)")),
    #"Grouped Rows" = Table.Group(#"Filtered Rows", {}, { {"Applica no", each List.Min([Applica no]), type nullable number},{"Title", each List.First([Title]), type nullable text}, {"Actual", each List.Sum([Actual]), type nullable Currency.Type}, {"Forecast", each List.Sum([Forecast]), type nullable Currency.Type}})
in
    #"Grouped Rows"

 

How to use this code: Create a new Blank Query. Click on "Advanced Editor". Replace the code in the window with the code provided here. Click "Done".

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.