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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Thulasiram
Helper II
Helper II

To choose date

Dear all,  I have the following table visual.  
the column "Bal minus credit" is created by a measure.

I want the correspending date of the last negative value and would like to minus that date with a fixed date
for example "31-03-2024".  How to achieve that?  Appreciate help.

Screenshot 2024-08-16 054234.png

3 REPLIES 3
Ashish_Mathur
Super User
Super User

Hi,

Share the download link of the PBI file.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
amitchandak
Super User
Super User

@Thulasiram , Create a date table, join with date of you table

 

Last Negative Date =
CALCULATE(
MAXX(filter(Values('Date'[Date]),[Bal minus credit] < 0), [Date]), filter( all('Date'), 'Date'[Date] <= Max('Date'[Date])

))

 

 

Date Difference =
VAR FixedDate = DATE(2024, 3, 31)
VAR LastNegDate = [Last Negative Date]
RETURN
DATEDIFF(LastNegDate, FixedDate, DAY)

 

 

or

 


Value Difference =
VAR LastNegDate = [Last Negative Date]
RETURN
[Closing Balanace] - calculate ([Closing Balanace] , filter( all('Date'), 'Date'[Date] = [Last Negative Date]))

 

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
ahadkarimi
Solution Specialist
Solution Specialist

hi @Thulasiram create these two Measures and let me know if you encounter into any issues.


Find the last negative value date:

 

 

 

LastNegativeDate = 
CALCULATE(
    MAX('Table'[Date]),
    FILTER(
        'Table',
        'Table'[Bal minus credit] < 0
    )
)

 

 

 

Difference between the last negative date and the fixed date:

 

 

 

DateDifference = 
DATEDIFF(
    [LastNegativeDate],
    DATE(2024, 3, 31),
    DAY
)

 

 

 

 

Did I answer your question? If so, please mark my post as the solution! Your Kudos are much appreciated! Proud to be a Resolver II

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.