Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
5 years ago

Grouping by only sequential column values

Hello, 

 

I have a dataset that I would like to create different groups of data by collecting data based on column values in one main column but only while those values repeat without skipping a cell. Once the pattern is broken if the same value is seen again I would like for the grouping to restart.

 

For example:

 

Let's say I work for a fruit collecting company that only collects one type of fruit at a time in baskets that can hold 1000 fruit. We often switch what type of fruit we collect at random times and dates but we still only collect that one type of fruit.  We call these first 2 days of collecting apples "campaign #1" and the second time we begin collecting apples on 1/4/2021 we call that "campaign #2".

 

DateBasket #FruitNumber Of Fruits Collected
1/1/20211apple1000
1/1/20212apple1000
1/2/20213apple800
1/2/20214orange200
1/4/20215apple

1000

 

How could I group this data into campaigns using PowerBI?

3 Replies

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi this is very close to the solution I need but I have run into some errors. Firstly, the actual data I am trying to use contains letters and numbers instead of just letters like the words "apple" and "orange". Secondly, I would like to count campaigns for the other "fruit" being made as well. So in this case this would be campaign number one for oranges. I would also like to count the number of baskets within the campaign. with another column titled "basket number this campaign" that resets after each campaign.

       

      Could you please help me with this?

      • Jihwan_Kim's avatar
        Jihwan_Kim
        Icon for Super User rankSuper User

        Hi, Anonymous 

        Thank you for your feedback.

        Please share your sample pbix file, with some pictures of how your desired outcome looks like, then I can try to have a look into it.

        Thank you.

         

        Hi, My name is Jihwan Kim.

         

        If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.

         

        Linkedin: https://www.linkedin.com/in/jihwankim1975/