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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
raymond
Post Patron
Post Patron

Calculate Number of Days until a Value doubles

Hello community,

 

can onyone help me to calculate the number of days until a value doubles? I have searched online but couldnt find helpful ressources. Does anyone have something at hand?

 

 

1 ACCEPTED SOLUTION
v-alq-msft
Community Support
Community Support

Hi, @raymond 

 

Based on my research, you may create a measure as below.

 

 

CountDays = 
var _maxdate = 
CALCULATE(
    MAX('Table'[Date]),
    ALLSELECTED('Table')
)

var _maxvalue = 
LOOKUPVALUE(
    'Table'[Value],
    'Table'[Date],
    _maxdate
)

var _halfvaluedate = 
LOOKUPVALUE(
    'Table'[Date],
    'Table'[Value],
    CALCULATE(
        MAX('Table'[Value]),
        FILTER(
            ALLSELECTED('Table'),
            'Table'[Value]<=_maxvalue/2
        )
    )
)

return
DATEDIFF(
    _halfvaluedate,
    _maxdate,
    DAY
)+1

 

 

 

Result:

d1.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
v-alq-msft
Community Support
Community Support

Hi, @raymond 

 

Based on my research, you may create a measure as below.

 

 

CountDays = 
var _maxdate = 
CALCULATE(
    MAX('Table'[Date]),
    ALLSELECTED('Table')
)

var _maxvalue = 
LOOKUPVALUE(
    'Table'[Value],
    'Table'[Date],
    _maxdate
)

var _halfvaluedate = 
LOOKUPVALUE(
    'Table'[Date],
    'Table'[Value],
    CALCULATE(
        MAX('Table'[Value]),
        FILTER(
            ALLSELECTED('Table'),
            'Table'[Value]<=_maxvalue/2
        )
    )
)

return
DATEDIFF(
    _halfvaluedate,
    _maxdate,
    DAY
)+1

 

 

 

Result:

d1.png

 

Best Regards

Allan

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

The information you have provided is not making the problem clear to me. Can you please explain with an example.

Appreciate your Kudos.

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

It should work a little like this. Depending on the date selection one makes, the measure should calculate the number of days that are between the largest value (here accumulated) and half of the value.

 

 

2020-04-01 09_11_43-Mappe1 - Excel.png2020-04-01 09_11_59-Mappe1 - Excel.png2020-04-01 09_12_09-Mappe1 - Excel.png

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.

Top Solution Authors