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
Hi,
I have a table in my report that summerises a runing stock total.
I use a measure that find the lastest date which the stock levels fall below 0 - per material.
This all works fine. However, i then want to calculate the number of months between the date above and todays date.
When i add a measure with Today() in this completely unfilters all the filters than have been applied to the table in the first place.
Below
Visual Table
| Material ID | Date of First Neg Stock | 01/01/2024 | 01/02/2024 | 01/03/2024 |
| 123 | 01/03/2024 | 100 | 50 | -10 |
| 456 | 01/01/2024 | -100 | 200 | 400 |
| 789 | 01/02/2024 | 50 | -150 | 300 |
Date Of First Neg Stock = FIRSTNONBLANK ( 'LineOfBalance'[Date], IF ( [EndingBalance] < 0, 1) )
When I add a measure thaty includes Today() i then see all other material IDs that have previously been filtered (correctly)
so i am wodering how i can get my measure to calculate between [Date Of First Neg Stock] and Todays date?
Many thanks,
Josh
Hi @Jtbonner1986 ,
You can create a new measure.
Months Since First Neg Stock =
VAR CurrentDate = TODAY()
RETURN
IF (
NOT ISBLANK([Date Of First Neg Stock]),
DATEDIFF([Date Of First Neg Stock], CurrentDate, MONTH),
BLANK()
)
If the above one can't help you get the desired result, please provide some sample data in your tables (exclude sensitive data) with Text format and your expected result with backend logic and special examples. It is better if you can share a simplified pbix file. Thank you.
Best Regards,
Neeko Tang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Please provide sample data for all participating tables.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 38 | |
| 36 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 129 | |
| 88 | |
| 79 | |
| 68 | |
| 63 |