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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
ThornTech
Frequent Visitor

Counting days to new peaks

I'm building out a Dashboard to carry out analysis on Backtest results from Algo trading. For the most part it's going well, but I'm stuck on 1 aspect at the moment.

 

I have the following date where:

Date is from a date table

Balance is from the raw data

Peak is calculated via a standard Dax shown under the table

Concurrency is where I'm stuck, I want to count the number of days the peak stays the same so I can calc the amount of days between peaks.

 

Any advice would be appreciated. Thanks Chris

DateBalancePeakConcurrency
01/01/2022

1000

10001
02/01/2022100510051
02/01/202290010052
02/01/202295010053
02/01/2022110011001

 

 

Peak Strat = MAXX(FILTER(ALLSELECTED('FX Export Primary'), 'FX Export Primary'[Trade UID] <=MAX('FX Export Primary'[Trade UID])),'FX Export Primary'[Equity])

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@ThornTech,

I'd like to suggest you extract the current date from the calendar table and use it and user id as conditions to filter table records and get corresponding results:

Peak Strat =
VAR currDate =
    MAX ( Calendar[Date] )
RETURN
    CALCULATE (
        MAX ( 'FX Export Primary'[Equity] ),
        FILTER (
            ALLSELECTED ( 'FX Export Primary' ),
            'FX Export Primary'[Date] <= currDate
        ),
        VALUES ( 'FX Export Primary'[UID] )
    )

If these also don't help, please share some dummy data or pbix file with expected results to help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

View solution in original post

1 REPLY 1
Anonymous
Not applicable

@ThornTech,

I'd like to suggest you extract the current date from the calendar table and use it and user id as conditions to filter table records and get corresponding results:

Peak Strat =
VAR currDate =
    MAX ( Calendar[Date] )
RETURN
    CALCULATE (
        MAX ( 'FX Export Primary'[Equity] ),
        FILTER (
            ALLSELECTED ( 'FX Export Primary' ),
            'FX Export Primary'[Date] <= currDate
        ),
        VALUES ( 'FX Export Primary'[UID] )
    )

If these also don't help, please share some dummy data or pbix file with expected results to help us clarify your scenario and test to coding formula.

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Helpful resources

Announcements
September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.