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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
shri0025
Helper II
Helper II

create new Column

Hi  Team 

Please help me    i need  new Column     Gate entery Basis  if  gatey entery multipule  i need single amount  Freight amount   Like my output.

Gate entryFreight Amount
CDA103129312850
CDA103129312850
CDA103129812000
CDA103129812000
CDA103129812000
CDA103129812000
CDA103129812000
CDA103133112000
CDA103133112000
CDA103141112100
CDA103141112100
CDA103142412100
CDA103142412100
CDA103142412100
CDA103142412100
CDA103148212800
CDA103148212800
CDA103148212800
CDA103148212800
CDA103148212800
CDA103148212800
CDA103148212800
CDA103148212800
CDA103148212800
CDA103148212800
CDA103149312200

My Out put Like This 

Gate entryFreight AmountCreate Column (Need this Result)
CDA10312931285012850
CDA1031293128500
CDA1031298120001200
CDA1031298120000
CDA1031298120000
CDA1031298120000
CDA1031298120000
CDA10313311200012000
CDA1031331120000
CDA10314111210012100
CDA1031411121000
CDA10314241210012100
CDA1031424121000
CDA1031424121000
CDA1031424121000
CDA10314821280012800
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA10314931220012200

 

 

2 ACCEPTED SOLUTIONS
Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

IN DAX
https://1drv.ms/u/s!AiUZ0Ws7G26Rixu4oV5LW2VcErUY?e=4oFKH2

View solution in original post

Anonymous
Not applicable

Hi @shri0025 ,

Please try below steps:

1. add an index column in Power Query pane

 

2. create a new column with below dax formula

Column =
VAR cur_entry = [Gate entry]
VAR cur_index = [Index]
VAR tmp =
    FILTER ( 'Table', [Gate entry] = cur_entry )
VAR _a =
    MINX ( tmp, [Index] )
RETURN
    IF ( cur_index = _a, [Freight Amount], 0 )

vbinbinyumsft_0-1697618647145.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Anonymous
Not applicable

Hi @shri0025 ,

Please try below steps:

1. add an index column in Power Query pane

 

2. create a new column with below dax formula

Column =
VAR cur_entry = [Gate entry]
VAR cur_index = [Index]
VAR tmp =
    FILTER ( 'Table', [Gate entry] = cur_entry )
VAR _a =
    MINX ( tmp, [Index] )
RETURN
    IF ( cur_index = _a, [Freight Amount], 0 )

vbinbinyumsft_0-1697618647145.png

Please refer the attached .pbix file.

 

Best regards,
Community Support Team_Binbin Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Ahmedx
Super User
Super User

Based on your description, I created data to reproduce your scenario. The pbix file is attached in the end.

IN DAX
https://1drv.ms/u/s!AiUZ0Ws7G26Rixu4oV5LW2VcErUY?e=4oFKH2

Hi 

 

Thanks  Ahmedx  Your  Solution is Perfect  but  i need in column Dax not in Query Because My data set is  Many Column   Column 1   to Column 45   so  I dont use  Query only used   Column in Dax . 

Ahmedx
Super User
Super User

to solve a problem in DAX you need an index or id column

shri0025
Helper II
Helper II

Hi 

 

Can you see me My out put column If Multipule Gate entery  then Freight AMount single and 0 

 

Gate entryFreight AmountCreate Column (Need this Result)
CDA10312931285012850
CDA1031293128500
CDA1031298120001200
CDA1031298120000
CDA1031298120000
CDA1031298120000
CDA1031298120000
CDA10313311200012000
CDA1031331120000
CDA10314111210012100
CDA1031411121000
CDA10314241210012100
CDA1031424121000
CDA1031424121000
CDA1031424121000
CDA10314821280012800
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA1031482128000
CDA10314931220012200
Ahmedx
Super User
Super User

pls try this

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WcnZxNDQwNjSyNFbSUTI0sjA1UIrVISxsARY2MKCbsLGxIQnCJoYQYUPihI1MaCdsYQQJweEtDE0nRiDhWAA=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Gate entry" = _t, #"Freight Amount" = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Gate entry", type text}, {"Freight Amount", Int64.Type}}),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Gate entry"}, {{"Count",
 each  Table.AddIndexColumn(_ , "indx",1,1)}}),
    #"Removed Other Columns" = Table.SelectColumns(#"Grouped Rows",{"Count"}),
    #"Expanded Count" = Table.ExpandTableColumn(#"Removed Other Columns", "Count", {"Gate entry", "Freight Amount", "indx"}, {"Gate entry", "Freight Amount", "indx"}),
    #"Added Custom" = Table.AddColumn(#"Expanded Count", "Result", each if[indx] =1 then [Freight Amount] else 0),
    #"Removed Columns" = Table.RemoveColumns(#"Added Custom",{"indx"})
in
    #"Removed Columns"
devesh_gupta
Super User
Super User

@shri0025 Try to create a calculated column using this DAX:

Create Column = 
VAR GateEntry = YourTableName[Gate Entry]
VAR FreightAmount = YourTableName[Freight Amount]
VAR GateEntryCount = CALCULATE(COUNTROWS(YourTableName), ALLEXCEPT(YourTableName, YourTableName[Gate Entry]))
RETURN
IF(GateEntryCount = 1, FreightAmount, 0)

If you find this insightful, please provide a Kudo and accept this as a solution.

 Hi Devesh 

Thanks for reply    it is not  working 

@shri0025 Can you specify any error that you're getting?

 

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!

December 2024

A Year in Review - December 2024

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