Forum Discussion

nisuomi's avatar
nisuomi
Icon for Resolver I rankResolver I
8 years ago

Compare to previous row on Table

Hi,

 

Is there any way, that I could compare the data between the rows in Power BI table?

 

For example I would like to check if the column named Joukkue is having a same name on the next row than in the previous.

On the image, you can see that the two first one are the same.

 

In QlikView, there is easy method to do this with the set analysis.

I am not so familiar with the DAX, but can't find any easy solution out of the box to this... If any ideas, please share :) Thank you!

 

 

 

Cheers,

Niko

3 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi nisuomi,

     

    Actually, power bi not contains column index and row index. For your scenario, you need to add an index column to compare with different rows.

    Then you can use index and index-1 to find out correspond records and previous record, compare these records to get result which you wanted.

     

    If you need some specific help about dax formula, you can provide some sample data to test.

     

    Regards,

    Xiaoxin Sheng

    • nisuomi's avatar
      nisuomi
      Icon for Resolver I rankResolver I

      Hello Anonymous,

       

      Well that is a bummer, that the Power BI can't (or won't) index the rows automatically if I create a table - that would be (too) handy.

      I can't understand if I add a manual index, can I use the same index to check on every different tables with the same index the situation, that we have a repeated teams?

       

      And other thing as well, how can I get a constant min date over all dates?

      I can get a min date with a filter, but when I put it to the table it shows the min for all of the relative dates - it should show the min for all the rows - any idea how can this be achieved?

       

      The calculation is

      seuraava_ottelupv = CALCULATE(MIN(Otteluohjelma[pvm]);isblank(Otteluohjelma[ratkaisu]))

       

      I can attach the workbook here as an attachment as well.

       

      It is just a public available stats from Finnish Hockey League website :)

      http://www.liiga.fi

       

       

      EDIT: How can I add an attachment... 

      EDIT2: Aparrently you can't, so here is a external link: https://www.dropbox.com/s/xnq9jn1auqhyn4z/pisteet.pbix?dl=0

       

       

       

      Cheers,

      Niko

      • Anonymous's avatar
        Anonymous
        Not applicable

        HI nisuomi,

         

        I think I'm stuck on your tables.(it is hard to analyse the effective column who used to calculate as index)

        In my opinion, my suggest is create new index table with 'Nimi' column and index, then find out 'Nimi' from current content, lookup above index table to find out previous/next one, compare these records.

         

        Notice: if your data contains any privacy data, please do mask sensitive data before sharing.

         

        Regards,

        Xiaoxin Sheng