Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
Hi,
I am stuck at creating a EC(Equity Curve values) caculated column using Dax language. I have elobarated the table as shown below in power BI desktop by adding custom column functions in power Query. Now I have to create calculated column in DAX that will give values as per the formula shown in excel file by using MTM column shown in power BI desktop figure 1. by taking initial value of EC column as 100.
Solved! Go to Solution.
I understand your concern. Let's break down the problem and try a different approach.
The primary challenge here is that you want to create a dynamic Equity Curve (EC) based on a Mark-to-Market (MTM) column in a calculated column. In DAX, calculated columns are computed during the data refresh and cannot refer to the same calculated column in their formula, which makes it challenging.
However, you can achieve this using a measure rather than a calculated column. Measures in DAX are computed at query time, and you can refer to previous values using patterns like cumulative totals.
Here's how you can create a measure for the Equity Curve:
EC Measure =
VAR CurrentDate = MAX('YourTableName'[Date]) // Replace 'YourTableName' and '[Date]' with your actual table and date column names
RETURN
CALCULATE(
SUM('YourTableName'[MTM]),
FILTER(
ALLSELECTED('YourTableName'),
'YourTableName'[Date] <= CurrentDate
)
) + 100 // Starting with an initial value of 100
How it Works:
Use the Measure in Visualizations: Once you've created the measure, you can use it in your Power BI visuals to display the dynamic Equity Curve based on the MTM values.
This approach should give you a dynamic Equity Curve based on the MTM values without relying on a calculated column that refers to itself. Remember to adjust table and column names in the DAX measure according to your actual data model in Power BI.
I hope this approach helps you achieve the desired outcome. Let me know if you have further questions or need additional assistance!
Thankyou so much,I have implemented this logic and can able to find get EC values without taking initial value as 100 at first. But I have wrote one more measure to add 100(to start initial EC value as 100) and multiply the result with 100 to get final and correct(changes this way give same result for EC) Values. Now, I could solve my issue with your support. I really appreciate your work.
Hi @Anonymous ,
Did the above suggestions help with your scenario? if that is the case, you can consider Kudo or Accept the helpful suggestions to help others who faced similar requirements.
If these also don't help, please share more detailed information and description to help us clarify your scenario to test.
How to Get Your Question Answered Quickly
Regards,
Xiaoxin Sheng
Creating an Equity Curve (EC) in Power BI using DAX based on the Mark-to-Market (MTM) values can be challenging, especially if you want to perform a calculation based on the previous row's value dynamically.
Here's how you can create a DAX calculated column for the Equity Curve:
Initialize EC Column: You mentioned that you want the initial value of the EC column to be 100. You can set this as the default value for the first row.
Calculate EC: For subsequent rows, you can use the formula to calculate the EC based on the previous row's EC value and the current MTM value.
Here's a basic example of how you can achieve this:
EC Calculated Column =
VAR CurrentRowMTM = TableName[MTM]
VAR PreviousEC =
IF(
ROWNUMBER() = 1, -- Check if it's the first row
100, -- Initial value of EC
CALCULATE(
MAX(TableName[EC]),
FILTER(ALL(TableName), TableName[Index] = EARLIER(TableName[Index]) - 1)
)
)
RETURN
PreviousEC + CurrentRowMTM
Creating an Equity Curve (EC) in Power BI using DAX based on the Mark-to-Market (MTM) values can be challenging, especially if you want to perform a calculation based on the previous row's value dynamically.
Here's how you can create a DAX calculated column for the Equity Curve:
Initialize EC Column: You mentioned that you want the initial value of the EC column to be 100. You can set this as the default value for the first row.
Calculate EC: For subsequent rows, you can use the formula to calculate the EC based on the previous row's EC value and the current MTM value.
Here's a basic example of how you can achieve this:
Note:
By following the steps and using the formula provided, you should be able to create an Equity Curve calculated column based on the Mark-to-Market values, with an initial value of 100 for the first row.
This didn't work. Is there any other solution to this?
Where do I get EC column in Max Function that itself have to be calculated, right? ..which you have return in Dax code.For the time being I have taken EC column with 100 as values in all the rows and copied your code. Also It is stating an error that ROWNUMBER() parameter must be table. I am really thankful that you tried solving my problem. Awaiting for your response.
I understand your concern. Let's break down the problem and try a different approach.
The primary challenge here is that you want to create a dynamic Equity Curve (EC) based on a Mark-to-Market (MTM) column in a calculated column. In DAX, calculated columns are computed during the data refresh and cannot refer to the same calculated column in their formula, which makes it challenging.
However, you can achieve this using a measure rather than a calculated column. Measures in DAX are computed at query time, and you can refer to previous values using patterns like cumulative totals.
Here's how you can create a measure for the Equity Curve:
EC Measure =
VAR CurrentDate = MAX('YourTableName'[Date]) // Replace 'YourTableName' and '[Date]' with your actual table and date column names
RETURN
CALCULATE(
SUM('YourTableName'[MTM]),
FILTER(
ALLSELECTED('YourTableName'),
'YourTableName'[Date] <= CurrentDate
)
) + 100 // Starting with an initial value of 100
How it Works:
Use the Measure in Visualizations: Once you've created the measure, you can use it in your Power BI visuals to display the dynamic Equity Curve based on the MTM values.
This approach should give you a dynamic Equity Curve based on the MTM values without relying on a calculated column that refers to itself. Remember to adjust table and column names in the DAX measure according to your actual data model in Power BI.
I hope this approach helps you achieve the desired outcome. Let me know if you have further questions or need additional assistance!
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
7 | |
7 | |
6 | |
6 |
User | Count |
---|---|
27 | |
12 | |
10 | |
9 | |
6 |