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
Anonymous
Not applicable

Automated List Management

The goal is to automate my list managment process for software deployments.  

 

I am looking to create a calculated column, that will take a few filters and row count inter consideration.

 

For example.. I would first sort by user computer type > user location > user department.  Then I would say I want to break this up into waves of 50 people each.  So the output would be "Wave 1" for the first 50 users based on the sorting criteria, then as soon as it hit the 51st user, the next 50 users would be "Wave 2" 

 

Idealy I would want to be able to do this in Power BI so I can keep the direct connection to my data sources.  

The code for this column should also be able to update relatively easy.  For example, if I wanted to add sorts, or filter some things out, change the user count per wave from 50 to 100.. etc..

 

Any ideas would be super helpful!  

 

Thank you,

 

Ryan Mulhollem

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

HI, @Anonymous 

You could try this way:

First add an index column. Refer this post: https://community.powerbi.com/t5/Desktop/Creating-calculated-index-column-in-DAX/m-p/635397#M303922

Second, divide this index column by 50 (Integer)

INT((Table1[Index]-1)/50)

Then get result column

group = "Wave "&INT((Table1[Index]-1)/50)+1

For example:

In my simple sample, I use 3 instead of 50

4.JPG

 

Best Regards,

Lin

 

 

 

Community Support Team _ Lin
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

8 REPLIES 8
v-lili6-msft
Community Support
Community Support

HI, @Anonymous 

You could try this way:

First add an index column. Refer this post: https://community.powerbi.com/t5/Desktop/Creating-calculated-index-column-in-DAX/m-p/635397#M303922

Second, divide this index column by 50 (Integer)

INT((Table1[Index]-1)/50)

Then get result column

group = "Wave "&INT((Table1[Index]-1)/50)+1

For example:

In my simple sample, I use 3 instead of 50

4.JPG

 

Best Regards,

Lin

 

 

 

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

Hi @v-lili6-msft 

For the example, I changed the count change from 50 to 5 for simplistic reasons.  As you can see from below, the count is updating every 5, however if the location changes, the count resets.  I am getting thrown an error with the EARLIER function.. my formula is below.  Thank you again for your assistance here.

Test Column = COUNTROWS(FILTER(UserList, EARLIER(UserList[Location])= UserList[Location], INT((UserList[Index]-1)/5)+1))

 

UserNameLocationExpected Output
User 1NYC1
User 2NYC1
User 3NYC1
User 4NYC1
User 5NYC1
User 6NYC2
User 7NYC2
User 8NYC2
User 9London3
User 10London3
User 11London3
User 12London3
User 13London3
User 14Baltimore4
User 15Baltimore4
User 16Baltimore4
User 17Baltimore4
User 18Baltimore4
User 19Baltimore5
User 20Baltimore5
User 21Baltimore5
User 22Baltimore5
User 23Houston6
User 24Houston6
User 25Houston6
User 26Princeton7
User 27Princeton7
User 28Princeton7
User 29Princeton7
User 30Princeton7
User 31Princeton8
User 32Princeton8

 

 



 

Anonymous
Not applicable

@v-lili6-msft So technically this does serve as the answer to my question.  My only concern is the lack of customization.  

Is there a way to make this conditional as well?  For example - if I am doing wave 1 up to 50 people, however if the city changes (pre-sorted when making the index), the count should reset to 1.  So if there are only 38 people in NYC for example, the count should stop at the 38th person and reset at 39.  I know how to do this with Excel just not Power Query / BI

hi, @Anonymous 

For your requirement, you need to use EARLIER Function to add the index column by group.

 

Best Regards,

Lin

 

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

Hi Lin,

 

First thank you for your response and help.  

 

The EARLIER Function only works on numeric values.  I want the conditional column to be based off of user location such as NYC, Baltimore, China, etc.. 

 

This is an example of my failed attempt..image.png

hi, @Anonymous 

EARLIER Function should be used as below:

Earlier(NonMHFTreeUsers[Location])=NonMHFTreeUsers[Location]

And I couldn't find out the logic of your formula, you could share some simple sample data and expected output.

 

 

Best Regards,
Lin

 

 

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

Thank you for your response Lin.  Let me work on this and let you know if it works!

Anonymous
Not applicable

Also, just a thought.  It would be useful if I could grab the category of another column for the naming convention of these migration waves.  For example, if the user is located in Asia Pacific, the wave name would be "Asia Pacific - Wave 1"

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.