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

Get inspired! Check out the entries from the Power BI DataViz World Championships preliminary rounds and give kudos to your favorites. View the vizzies.

Reply
Jtbonner1986
Helper I
Helper I

Today() function DAX unfiltering my visual table

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 IDDate of First Neg Stock01/01/202401/02/202401/03/2024
12301/03/202410050-10
45601/01/2024-100200400
78901/02/202450-150300

 

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

2 REPLIES 2
v-tangjie-msft
Community Support
Community Support

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. 

lbendlin
Super User
Super User

Please provide sample data for all participating tables.

Helpful resources

Announcements
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!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

March2025 Carousel

Fabric Community Update - March 2025

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