Generating Row Number in Power BI Visualization Using DAX

Sdílet
Vložit
  • čas přidán 31. 07. 2024
  • I have previously explained how to generate a row-number using Power Query. That method is good for pre-calculating row-numbers in the table. However, sometimes, you want to calculate the row number in a visual, based on something dynamic. That is where DAX comes handy. Let's see how this is possible.
    Download the file and study more from my blog article here:
    radacad.com/generating-row-nu...
    *******************
    Want to learn about Power BI or AI? or take your Power BI and AI knowledge to the next level for building reports? Check out our courses in RADACAD Academy for all aspects of Power BI and AI.
    RADACAD courses: learn.radacad.com
    Become an academy member: learn.radacad.com/academy/
    *******************
    ********
    CONNECT with US!
    ********
    -- / radacad_com
    -- / rad_reza
    -- / leila_etaati
    -- / radacad
    -- / leila-etaati-b0304636
    -- / rezarad
    -- / 6393399
    -- radacad.com
    ********
  • Věda a technologie

Komentáře • 20

  • @filipwinski4219
    @filipwinski4219 Před 4 lety +5

    Thank you for the video. I think that in Power BI the row number should be just an built-in option for table or matrix. It is perfectly solved in Data Studio by Google. As a matter of fact the solution with RANKX is not exactly row number, but just rank number - it is noticeable after table sorting.

    • @RADACAD
      @RADACAD  Před 4 lety +1

      I strongly believe this would be a built-in option in the future 😊

    • @ignaciovivar9601
      @ignaciovivar9601 Před dnem

      Hola, alguna solución para que no se muevan de sitio los números de fila?

  • @sanjeevsoni6793
    @sanjeevsoni6793 Před 4 lety

    Reza; Great and simple explanation; Three Cheers!!

  • @divakarkrishnan6954
    @divakarkrishnan6954 Před 4 lety

    Awesome reeza.. Informative indeed.. Thank you...

  • @Kmsbi
    @Kmsbi Před 4 lety +1

    Thank you so much for sharing.

  • @pabeader1941
    @pabeader1941 Před 4 lety

    It's actually more like generating sort ranking. I like it and I really appreciate the explanation of how it works.

    • @RADACAD
      @RADACAD  Před 4 lety

      it is indeed sort ranking 😊

  • @tosinopeniyi1407
    @tosinopeniyi1407 Před 4 lety

    Many thanks Reza.

  • @SolutionsAbroad
    @SolutionsAbroad Před 4 lety

    Thanks for the video Reza, great content as always, precise and enough details on RANKX. Do you think this will work with calculation groups?

  • @abhijitkaware6627
    @abhijitkaware6627 Před 3 lety +1

    Hi Reza that was really nice I have few questions:
    1. Can we pass more than 2 measures?
    2.How to generate unique row number here?

    • @DivyanshVaidya1712
      @DivyanshVaidya1712 Před 2 lety

      Hi Reza,
      Related to the first one. I have a use-case where I have both Internet and Retail sales pulled into the grid and I need to update my ranking column according to the measure by which the grid is currently sorted. Basically i need the rank column to be dynamic such that it should show ranking for Internet sales if i sort the table with Internet sales and the same with Retail sales.

  • @wuzizname1330
    @wuzizname1330 Před 15 dny

    Killer tip! Problem with me is, if I change the slicers to show different business groups the RANKX keeps the rank number as if all items are selected. For example Johnny is the #10 overall salesperson, but #1 in Canada. When I apply a filter to show only Canadian salespeople Johnny is at the top but his rank still shows as 10. Any way to fix this?

    • @wuzizname1330
      @wuzizname1330 Před 14 dny +1

      Replacing ALL with ALLSELECTED works

    • @RADACAD
      @RADACAD  Před 14 dny +1

      Yes, I have another video about ALL vs ALLSelected too.
      depending on the requirement you may use one or the other

  • @RobertSmith-pf8ox
    @RobertSmith-pf8ox Před 2 lety

    This is very useful video.
    Thank you very much.
    Would it be possible to modify that measure in order to get correct grand total (equals maximum row number)?

    • @RADACAD
      @RADACAD  Před 2 lety +1

      Sure you can, you will need an IF statement that determines if you are in the total row, such as ISFILTERED, and then get the COUNTROWS in that case rather than the row number. I explained here how you can control the total in a DAX expression: czcams.com/video/TP82dLISmgo/video.html

    • @RobertSmith-pf8ox
      @RobertSmith-pf8ox Před 2 lety

      @@RADACAD Thank you very much

  • @lindabond9307
    @lindabond9307 Před 2 lety

    I need to generate row numbers for a big list / over 10k, and DAX / PBI doesn't like that, RANKX can't handle it (understandably). You'd think Row Numbers would be really straightforward task :(