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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
sokatenaj
Helper III
Helper III

Sum issue

Hi Folks,

 

Trying to do something with 6 stock periods, though the table below only shows 3. I have employees that have 6 columns of shares with different vest dates. What I want to do is Sum across the total shares and then add a date parameter to it, but I can't quite get it to work as a measure. This is what I have: 

 

1  Shares =
2    CALCULATE (
3    SUMX(Stock,Stock[Shares 1]+Stock[Shares 2]+Stock[Shares 3]+Stock[Shares 4]+Stock[Shares 5]),
4    'Stock'[Vest Date 1] >= DATE ( 2017, 11, 1 ) && 'Stock'[Vest Date 1] <= DATE ( 2022, 12, 31 ),
5    'Stock'[Vest Date 2] >= DATE ( 2017, 11, 1 ) && 'Stock'[Vest Date 2] <= DATE ( 2022, 12, 31 ),
6    'Stock'[Vest Date 3] >= DATE ( 2017, 11, 1 ) && 'Stock'[Vest Date 3] <= DATE ( 2022, 12, 31 ),

7    'Stock'[Vest Date 4] >= DATE ( 2017, 11, 1 ) && 'Stock'[Vest Date 4] <= DATE ( 2022, 12, 31 ),

8    'Stock'[Vest Date 5] >= DATE ( 2017, 11, 1 ) && 'Stock'[Vest Date 5] <= DATE ( 2022, 12, 31 ),

9    )

 

I know the first 3 lines are correct and I know if I just used 1 date line and then closed it with a ")" it works based on just Vest Date 1, but I need to add those other dates because there may be a chance where they are all different. One thing to note is that each share group is released on the vest date. For example, Shares 1 would be linked to Stock[Vest Date 1]. 

 

This is how the data is laid out on the table. The key to the master table is empl ID:

 

Empl IDShares 1Vest Date 1Shares 2Vest Date 2Shares 3Vest Date 3
5551231,417.0005/01/20171,417.0005/01/20181,416.0005/01/2019
5551231,600.0007/01/20181,600.0007/01/20191,600.0007/01/2020
100000334.0005/01/2017333.0005/01/2018333.0005/01/2019
200000459.0005/01/2016458.0005/01/2017458.0005/01/2018
300000482.0007/01/2018482.0007/01/2019481.0007/01/2020
300000367.0005/01/2017367.0005/01/2018366.0005/01/2019
400000600.0007/01/2018600.0007/01/2019600.0007/01/2020
500000500.0009/30/20162,000.0009/30/20171,000.0009/30/2018
6000001,250.0009/30/20171,500.0009/30/20181,250.0009/30/2019

 

Any help would be great please. 

Thank you!

 

13 REPLIES 13
parry2k
Super User
Super User

What expected output you are trying to achieve?



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

@parry2k The total # of shares of each employee based on the date range. 

 

Basically, all I want to see the total shares each individual has on a date range of Nov 1 2017 up to December 31, 2022. Problem is that they get a batch of shares at each vest date. Plus some of the data has shares already vested which I don't want which is why I need the date range. 

 

Many thanks!!!!!!

it required unpivot of data and then it is easy, i quickly put together pbix for your reference, change it as per your need.

 

https://drive.google.com/open?id=0B4dPgH9_BPBrOG9rR01HOGFjOGM



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks @parry2k, but I can't undo the data like that because the sum of shares for each employee needs to be rolled into a table visual with other employee data. There are thousands of rows and I get new feeds daily so need to automate it better some how. 

 

There must be a different way to create it as a measure so that I can plop it in a table visual...

it is already automated, how you want to sum up date, curren t view in my pbix is by employee but you can always group it by other columns. If you can share your desired output, it will help.

 

Question, do you get data stream in the format you shared or it is different. May be there is an opportunity to improve the model. All I suggested based on data model you shared.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

The data I have can only be delivered in that format from the system. There are about 50 other fields in addition to the ones notated, but the ones I put down are the only ones I care about. I have a table visual on another page and this is the end goal: 

 

Empl IDJob TitleSalary# SharesValue (@ $18/share)Total CompGroup
100000VP $        400,000334 $                             6,012 $           406,012Engineering
200000Manager $        150,000458 $                             8,244 $           158,244Communications

 

Shares being the # of shares from the data notated in previous post with vesting dates greater than Nov 1, 2017. 

 

So you see, I can't do it like that because I need to put it in a table that is not date filtered which is why I need to get this in a measure format...

 

Not everyone will have stocks and there are times where I may need to kick out Vest 1 and Vest 2, only to include Vest 3 or change the date parameters in a measure...

 

 

sorry buddy, i'm not very clear what i proposed why that will not work. i'm surely missing something here. i hope someone else can help.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks @parry2k. I hope so too. I'm on a time crunch and I'm doomed right now...

Well I'm more than happy to help but still not very clear what is not working and what the challenge is. may be share your pbix file with some sample data, that might help. 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

I know, but I need it as a measure as I am not doing pivots or using it as a visual. It needs to be used as a field in the main Table visual, not as its own. I can use your method if I needed to do it as its own visual as you have it laid out, but not in this case. 

not sure why you stuck it that you need it as measure. anyhow just added it as a "Total Shares" measure and updated pbix.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thanks @parry2k. I'm just going to do this a different way by just deleting the data in the document prior to Nov 1 2017 and using SumX. 

 

 

Sounds good.

 

Good luck!



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

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.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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