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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AnilKumar
Helper II
Helper II

repeat column values based on another column

Hi all,

I am Struggling since long back. I have data like 

Order numoriginal dateactual dateinvoiced amt times
Order1June-2016June-20161
Order1sept-2016march-20173
Order1dec-2016march-20182
Order1march-2017  
Order1june-2017  
Order1sept-2017  
Order1dec-2017  
Order1mar-2018  
Order1june-2018  

 

What i Need is a new column which will be like,

Order numoriginal dateactual dateinvoiced amt timesNEw Colum
Order1June-2016June-20161June-2016
Order1sept-2016march-20173march-2017
Order1dec-2016march-20182march-2017
Order1march-2017  march-2017
Order1june-2017  march-2018
Order1sept-2017  march-2018
Order1dec-2017   
Order1mar-2018   
Order1june-2018   

 

So based on the No.of times column, the new column shold be derived.

 

Please suggest an idea.

 

Thanks in Advance.

Regards,

Vishnu priya

1 ACCEPTED SOLUTION
v-qiuyu-msft
Community Support
Community Support

Hi @AnilKumar

 

You can create a index column in Query Editor firstly: 

 

a1.PNG

 

Then create calculated columns below: 

 

EndRowNum = CALCULATE(SUM('Table'[invoiced amt times]),FILTER('Table','Table'[Index]<=EARLIER('Table'[Index])))
 
StartRowNum = 'Table'[EndRowNum]-'Table'[invoiced amt times]+1
 
Column = CALCULATE(MIN('Table'[actual date]),FILTER('Table',EARLIER('Table'[Index])>='Table'[StartRowNum]&&EARLIER('Table'[Index])<='Table'[EndRowNum]))
 
w4.PNG
 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

4 REPLIES 4
Ashish_Mathur
Super User
Super User

Hi,

Based on the 3rd and 4th columns, you want to generate the 5th column.  What is the use of the 1st and 2nd columns?


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

Hi,
The first column is about the order number. There might be n number of orders. And the 2nd column tells the data about the month to be invoiced.
Based on this only the no.of records of particular order depends.
Thanks & regards ,
Vishnu priya
v-qiuyu-msft
Community Support
Community Support

Hi @AnilKumar

 

You can create a index column in Query Editor firstly: 

 

a1.PNG

 

Then create calculated columns below: 

 

EndRowNum = CALCULATE(SUM('Table'[invoiced amt times]),FILTER('Table','Table'[Index]<=EARLIER('Table'[Index])))
 
StartRowNum = 'Table'[EndRowNum]-'Table'[invoiced amt times]+1
 
Column = CALCULATE(MIN('Table'[actual date]),FILTER('Table',EARLIER('Table'[Index])>='Table'[StartRowNum]&&EARLIER('Table'[Index])<='Table'[EndRowNum]))
 
w4.PNG
 

Best Regards,
Qiuyun Yu 

Community Support Team _ Qiuyun Yu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thanks. It worked for my case.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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