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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

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
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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