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

Shape the future of the Fabric Community! Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions. Take survey.

Reply
Anonymous
Not applicable

Row Count Loop / Calculated Column

 

Dear All,

 

I need to produce two columns, A & B. 

 

In column A : I need to count rows from 1 till 7 and the restart the counter in next row just as in the visual below until the end of the paticular stock eg AAPL.

 

In column B : I need to give a consecutive unique ID per group of 7 eg. AAPL1 ... AAPL2 ... AAPL3 ...

 

Would need to create this using calculated columns, i have been trying for hours whithout any luck. 

 

Demo.PNG

 

Thnak you for any possible help 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , create a new column like

New column = "APPL" & (Quotient([countrows test] -1,7) +1 )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

View solution in original post

6 REPLIES 6
BenChevalier
Frequent Visitor

Hi @Anonymous  👋

 

Can you explain how you generated the "Countrows test" column in the first place ? I need a similar field to create an id identifying which data came before which.

 

Many thanks and have a great day, 🙂

Ashish_Mathur
Super User
Super User

Hi,

Paste data in a format that can be taken to an MS Excel file.  Also, against which number of column A do you want see AAPL1 or AAPL2 - should it be against 1 or 7?


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
Anonymous
Not applicable

Hi @Syndicate_Admin 

 

Can you please do such calculations in Power Query, not in DAX? Power Query is the right place for this. In DAX it's possible but will be 1) ugly and 2) slow.

amitchandak
Super User
Super User

@Anonymous , create a new column like

New column = "APPL" & (Quotient([countrows test] -1,7) +1 )

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here
Anonymous
Not applicable

Hi,

 

How about doing somting like the following:

 

Dividing the cycle length into 4 pieces each piece has 2 rows (Dates). Then take the sum of the change column and avarege it out. How would you implement something along those line? 

 

Capture.PNG

 

THanks for any help

Anonymous
Not applicable

Hi Amitchandak, 

 

Uuff!!!  Thank you very much for the reply, supper easy solution. I was able to create both needed column with your Dax formula. 

 

Million thanks,

Kr

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

Find out what's new and trending in the Fabric Community.

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.