Power BI is turning 10, and we’re marking the occasion with a special community challenge. Use your creativity to tell a story, uncover trends, or highlight something unexpected.
Get startedJoin us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.
Hello, and thank you in advance to anyone who can help me.
I have a stock of products from the store, from a gas station.
There are purchases and sales. I need a column that gives me the total which is: 1st purchase - SALES + PURCHASES. Here is a sample excel:
DATE | SHOPPING | SALES | STOCK |
14/6/2024 | 24 | 24 | |
15/6/2024 | 1 | 23 | |
17/6/2024 | 1 | 22 | |
17/6/2024 | 2 | 20 | |
19/6/2024 | 1 | 19 | |
19/6/2024 | 1 | 18 | |
19/6/2024 | 1 | 17 | |
3/7/2024 | 1 | 16 | |
5/7/2024 | 1 | 15 | |
7/7/2024 | 2 | 13 | |
10/7/2024 | 1 | 12 | |
24/7/2024 | 48 | 60 | |
9/8/2024 | 2 | 58 |
I need to calculate a column that the stock has so that I can then value it. The date should not matter unless it is searched as a starting point and a variable can be saved with the initial stock.
The MTDTODAY, QTDTODAY, and YTDTODAY functions are of no use to me because the calculation starts again when the period of the used formula ends
Thanks a lot
Gears
Solved! Go to Solution.
Hi,
I have solved a similar question in the attached files.
Hope this helps.
@Syndicate_Admin
Taking a look at the question and considering only the scenario presented, the measure to calculate the stock would be:
Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI
Hello, thanks for your help but what I need to chalk up is the STOCK column.
You need a calculated column? If yes, then the DAX is:
Regards,
Marcel Magalhães
Microsoft Power BI Official Partner
MCT | Certified PL-300 Power BI
Hello, I wanted to say that I need a new measure that calculates the column that I called Stock where I take the 24 initial products (the first purchase) and add the new purchases and subtract the sales.
This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.
Check out the June 2025 Power BI update to learn about new features.
User | Count |
---|---|
59 | |
53 | |
53 | |
36 | |
33 |
User | Count |
---|---|
80 | |
73 | |
45 | |
45 | |
43 |