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

Grow your Fabric skills and prepare for the DP-600 certification exam by completing the latest Microsoft Fabric challenge.

Reply
DanduMani104
Helper III
Helper III

need help with Rank Column

Hello team, need help
I have a Appened-TMR table in power bi, and I have PAX and FREE_PAX columns in that.But In PAX and FREE_PAX have repeated numnbers in those columns.I want create a ranking Order for those ttwo columns For distinct count of values..like if three rows having the values 12,12,12 ,It shoud be gave the rank numberes like 1,2,3 and For another values are also should be started from 1,2,3 like that I want to give the ranks for both columns by adding additional columns to that table. So that I will uese those ranking Orders in DAX functions..How can I achieve this in power bi.

I have created a rank column in Database like below

DanduMani104_0-1705992138347.png

like same I want to add a column to the table in power Query in PBI for below columns

DanduMani104_1-1705992226644.png

 

1 ACCEPTED SOLUTION

It asks for login, Copy from Excel and paste it here ot share the link after saving in Google Drive

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

View solution in original post

9 REPLIES 9
DanduMani104
Helper III
Helper III

How can add aExcell file

 


You can save it in OneDrive, Google Drive, or any other cloud-sharing platform and share the link here.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

It asks for login, Copy from Excel and paste it here ot share the link after saving in Google Drive

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Fowmy
Super User
Super User

@DanduMani104 

I made a sample dataset to represet your scenario and got the desired results, Create a blank Query, go to the Advanced Editor, clear the existing code, and paste the codes give below and follow the steps.

 

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText("i45WMjRUitUhijI2wk0ZmoMpI1N0KhYA", BinaryEncoding.Base64), 
        Compression.Deflate
      )
    ), 
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [PAX = _t]
  ), 
  #"Changed Type" = Table.TransformColumnTypes(Source, {{"PAX", Int64.Type}}), 
  #"Grouped Rows" = Table.Combine(
    Table.Group(
      #"Changed Type", 
      {"PAX"}, 
      {{"data", each Table.AddIndexColumn(_, "FreePAX", 1, 1, type number)}}
    )[data]
  )
in

 

 

Fowmy_0-1705993347251.png
Basically, you need to step in your table:

#"Grouped Rows" = Table.Combine(
    Table.Group(
      #"Changed Type", 
      {"PAX"}, 
      {{"data", each Table.AddIndexColumn(_, "FreePAX", 1, 1, type number)}}
    )[data]
  )

 

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

DanduMani104_0-1705993632241.png

Its showing error

@DanduMani104 
Sorry, after "in", you need to add the last step. I modifed it.

let
  Source = Table.FromRows(
    Json.Document(
      Binary.Decompress(
        Binary.FromText("i45WMjRUitUhijI2wk0ZmoMpI1N0KhYA", BinaryEncoding.Base64), 
        Compression.Deflate
      )
    ), 
    let
      _t = ((type nullable text) meta [Serialized.Text = true])
    in
      type table [PAX = _t]
  ), 
  #"Changed Type" = Table.TransformColumnTypes(Source, {{"PAX", Int64.Type}}), 
  #"Grouped Rows" = Table.Combine(
    Table.Group(
      #"Changed Type", 
      {"PAX"}, 
      {{"data", each Table.AddIndexColumn(_, "FreePAX", 1, 1, type number)}}
    )[data]
  )
in

 #"Grouped Rows"
Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

But those columns should be added to the table...I should not come seperately

I have a Appened-TMR table in power bi, and I have PAX and FREE_PAX columns in that.But In PAX and FREE_PAX have repeated numnbers in those columns.I want create a ranking Order for those ttwo columns For distinct count of values..like if three rows having the values 12,12,12 ,It shoud be gave the rank numberes like 1,2,3 and For another values are also should be started from 1,2,3 like that I want to give the ranks for both columns by adding additional columns to that table. So that I will uese those ranking Orders in DAX functions..How can I achieve this in power bi.

 

@DanduMani104 

Create a sample table in Excel with the expected result and paste it here in your reply.

Did I answer your question? Mark my post as a solution! and hit thumbs up


Subscribe and learn Power BI from these videos

Website LinkedIn PBI User Group

Helpful resources

Announcements
Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel1

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.