Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I have a data set where each stock id number for each day it is in stock, is a row. From this I have already created measures for Min and Max in stock dates. Now I need to find the duration in stock for each stock id number. How can I subtract the Min stock date from the Max stock date for each ID number?
Solved! Go to Solution.
@Anonymous , Try like
averageX(summarize(Table, Table[Stick ID], "_1", min([Min Stock Date]), "_2", max([MaxStock Date])), datediff([_1],[_2],Day))
Or use Sumx
@Anonymous , Try like
averageX(summarize(Table, Table[Stick ID], "_1", min([Min Stock Date]), "_2", max([MaxStock Date])), datediff([_1],[_2],Day))
Or use Sumx
@Anonymous - ([Max] - [Min]) * 1. = # Days
Greg, will that maintain the Stock ID relationship?
@Anonymous - If you put the Stock ID in a table visualization along with that measure, yes. I am making a ton of assumptions though.
Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882
Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490
The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
Check out the November 2025 Power BI update to learn about new features.
| User | Count |
|---|---|
| 59 | |
| 46 | |
| 42 | |
| 23 | |
| 18 |
| User | Count |
|---|---|
| 192 | |
| 125 | |
| 99 | |
| 67 | |
| 48 |