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
kcantor
Community Champion
Community Champion

Use PowerQuery/M to calculate time in pod

I have ordered the book on M but still haven’t learned enough to be of any use. So, here I am again on the board asking for help making powerquery do my bidding.

I have a ‘Pod Members” table that I need to create a couple of calculations on. It has true duplicate entries that I need to remove in order to make the pivot table work but I don't  know how to automatically judge which entry to keep. I also need to calculate days in pod, days in training, and, using that calculation create pod memberships.

I have attached a modified version of the table here. The names have been changed to protect the innocent.

Steps I need to create:

1.)  Determine current pod membership. If a team member is currently in the pod, the end date will be 12/31/9999.  Remove/hide duplicate member names that have left a pod. In the attached table there should be 3 examples of those duplicates. Of course the next step may need part of the information from the deleted entries.

2.)  Determine if the member is in training. A member is in training if their start date is less than 45 days from the current date. After 45 days, they are no longer in training and count in calculations as a pod member. MSTARTED is not a new hire/ trainee but has switched to a new pod in the example.

3.)  Create a method of calculating pod current pod membership to be used as a divisor in sales calculations. I need to be able to divide sales calls and sales dollars by the number of current pod members who are out of training.  So, if a member is new, their calls and sales dollars count but the divisor is different. For example,  JLENON is in the Sales Ninjas pod but has not been with us for 45 days. Therefore, the Sales Ninjas pod membership count should be 2, not 3 until his training is complete.

4.)  As a wish list item, I would like to add a new column calculating the number of days spent in the new pod in case someone switched pods in the middle of a calculation period. My fear on this is how to keep them in two pods without creating duplicate entries that would negate table relationships. As a way to split sales calls and sales dollars between two pods if they changed to another.

As always, I appreciate your help and the sharing of your wisdom.

 

SalesPersonCodeFirst Training DateTopPodCodeStart DateEnd DateTopPodNameid
ALINCOLN9/23/2014 0:00TT1/1/2015 0:0012/31/9999 0:00Team Troll99
BCAUGHT10/27/2015 0:00BP2/6/2016 0:0012/31/9999 0:00Bro Pod57
BCAUGHT10/27/2015 0:00SJ10/27/2015 0:002/5/2016 0:00Sales Jedis58
FPAPER11/10/2015 0:00SJ11/10/2015 0:002/22/2016 0:00Sales Jedis108
GWASHINGTON1/5/2016 0:00BP1/5/2016 0:0012/31/9999 0:00Bro Pod109
JBEIBER2/17/2016 0:00SJ2/17/2016 0:0012/31/9999 0:00Sales Jedis261
JCASTILLION4/15/2014 0:00BP1/1/2015 0:001/12/2016 0:00Bro Pod317
JCASTILLION4/15/2014 0:00DP1/13/2016 0:0012/31/9999 0:00Digital Pod318
JLENON2/25/2016 0:00SN2/25/2016 0:0012/31/9999 0:00Sales Ninjas86
JOCEAN6/30/2015 0:00TT6/30/2015 0:0012/31/9999 0:00Team Troll141
KPEAN1/6/2011 0:00SN1/1/2015 0:0012/31/9999 0:00Sales Ninjas56
MSTARTED8/13/2013 0:00BC1/1/2015 0:004/1/2016 0:00Big Cheese205
MSTARTED8/13/2013 0:00DP4/2/2016 0:0012/31/9999 0:00Digital Pod206
NFASHION5/6/2013 0:00TT1/1/2015 0:0012/31/9999 0:00Team Troll222
OOSBORNE9/8/2015 0:00BC9/8/2015 0:0012/31/9999 0:00Big Cheese245
PFRAMPTON9/28/2010 0:00BC1/1/2015 0:0012/31/9999 0:00Big Cheese61
PMCCARTNEY8/11/2015 0:00SN8/11/2015 0:0012/31/9999 0:00Sales Ninjas81
STYLER3/18/2014 0:00BP1/1/2015 0:0012/31/9999 0:00Bro Pod78
TWEET5/27/2014 0:00BC1/1/2015 0:009/7/2015 0:00Big Cheese305
TWEET5/27/2014 0:00SJ9/8/2015 0:0012/31/9999 0:00Sales Jedis306




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




7 REPLIES 7
Anonymous
Not applicable

Hi @kcantor,

 

   such a lot of things to do. I'll check out if I can give you an hand.

Thanks for the example table, perfect for a copy&paste in Excel.

 

#I'M Not An Expert#

Your assistance would be greatly appreciated @Anonymous. I have reached the point of frustration and have actually built a couple of columns in a drastic attempt to overcome my lack of PowerQuery skills.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@MattAllington

Can you post the link for your book here? I have requested a copy from the PTB but would prefer to order from your link so I get instant access.  I am  STUMPED on PowerQuery.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@kcantor wrote:

@MattAllington

Can you post the link for your book here? I have requested a copy from the PTB but would prefer to order from your link so I get instant access.  I am  STUMPED on PowerQuery.


 You don't want my book if you want to learn Power Query. I recommended this one. http://exceleratorbi.com.au/product/m-is-for-data-monkey-digital-edition/

 

When end you are ready to learn DAX, then you will want my book. http://xbi.com.au/learndax



* Matt is an 8 times Microsoft MVP (Power BI) and author of the Power BI Book Supercharge Power BI.

Sorry @MattAllington, got my names mixed up. I actually have your book . . . and Rob's . . . and Avi's.  Was referring to the M is for (Data) Monkey. 

I have sent the link on to acquisitions.  Thank you for providing that link.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




mondinelli
Advocate I
Advocate I

can U posta a image of that table, text is misleading

podcalc.JPG





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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.