The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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
Date | Balance | Peak | Concurrency |
01/01/2022 | 1000 | 1000 | 1 |
02/01/2022 | 1005 | 1005 | 1 |
02/01/2022 | 900 | 1005 | 2 |
02/01/2022 | 950 | 1005 | 3 |
02/01/2022 | 1100 | 1100 | 1 |
Peak Strat = MAXX(FILTER(ALLSELECTED('FX Export Primary'), 'FX Export Primary'[Trade UID] <=MAX('FX Export Primary'[Trade UID])),'FX Export Primary'[Equity])
Solved! Go to Solution.
H @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
H @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
User | Count |
---|---|
11 | |
8 | |
6 | |
6 | |
6 |
User | Count |
---|---|
23 | |
14 | |
13 | |
9 | |
8 |