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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Calculate return with base value/index

Hi,

 

For a performance dashboard I m trying to create a measure that calculates the return based on a selected period.

If I want to calculate the return from 31-01-2021 till 30-04-201 then we have to multiply 100% * 3%*-1%*1.8%*0.4%

When we start on 28-2-2021 I expact that the measure would multiply 100%*-1%*1.8%*0.4%. 

So the MIN date value of the selected period always has to be 100% (or 1). Furthermore it could also be that we want to know 

the return between feb and april. In that case the calculation has to be 100%*-1%*1.8%.

 

For calculate the return Im using 

Investments_RETURN = PRODUCT(Fact_Return[Monthly_Return])
 
Could someone help, really stuck here :S 
 
Thanks in advance
 
Kind regards!

 

DateProductIdMonthly  Return
31-01-202112.5%
28-02-202113%
31-03-20211-1%
30-04-202111.8%
31-5-202110.4%

 

@tex628 @Greg_Deckler @Zubair_Muhammad 

1 ACCEPTED SOLUTION
tex628
Community Champion
Community Champion

Try something along the lines of this:

 

Measure =
VAR minDate = MIN(Calendar[Date])
VAR maxDate = MAX(Calendar[Date])
PRODUCTX(
SUMMARIZE( 
FILTER( ALLSELECTED(Table) , [Date] >= minDate && [Date] <= maxDate ) ,
[Date] , 
"Value" ,
IF( [Date] = minDate , 1 , 1 + [Monthly Return] )
) , 
[Value]
)

 

Br,
J


Connect on LinkedIn

View solution in original post

5 REPLIES 5
OwenAuger
Super User
Super User

Hi @Anonymous 

The basic calculation you want to do is:

 

Investments_RETURN = 
PRODUCTX ( 
    Fact_Return,
    1 + Fact_Return[Monthly_Return]
) - 1

 

I have ignored the issue of excluding the first date in the selected range - but you could hand this by filtering Date appropriately. Would it be acceptable to just filter on just the months whose return you want included? If so, you could leave the above formula unchanged.

 

There might be some other tweaks to produce the exact result you want, but hopefully that basic formula structure helps.

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn
Anonymous
Not applicable

Hi @OwenAuger,

 

Thanks for your reply and help. The formule gives me a good starting point to create the final measure.

The most difficult part for me is how to ,disable, the first month and replace it by 1 (100%)

 

PRODUCT(FACT_RETURN[RETURN]

 

A little bit more in detail, assume that I have a dataset where I have the return on daily basis, but I only want the values for the last day of the month (I think EOMONTH will fit here). Is a virtual table a possibe solution to make a selection?

 

The concept of the final measure would be  Return=100% + (Period). So the period is confusing me 🙂 

 

Kind regards

Hi again @Anonymous 

First off, your data model should include a Date table related to your 'return' table, to facilitate any date-related filtering or calculations.

 

To help answer your question, assuming you have daily returns, could you show how you would expect a typical report to look in table form, and how you want the end user to apply filters?

 

It sounds like you want to see monthly returns, and would you want users filtering by month as well?

 

Regards,

Owen


Owen Auger
Did I answer your question? Mark my post as a solution!
Blog
Twitter
LinkedIn
Anonymous
Not applicable

Hi @OwenAuger 

 

I really appriciate your reply and offer to help! Thanks

In our case the startdate (which can be  selected with a filter in the report) will always be 100%

There is a date table in the datamodel for filtering.

Lets assume that we want to see the results of the return for a period of six month. The endate would be 31-3-2021, which can also be selected in the filter.  

I hope the table below gives a better understanding.

 

Dickkieee_0-1620734477322.png

 

Thanks again for your help!

 

tex628
Community Champion
Community Champion

Try something along the lines of this:

 

Measure =
VAR minDate = MIN(Calendar[Date])
VAR maxDate = MAX(Calendar[Date])
PRODUCTX(
SUMMARIZE( 
FILTER( ALLSELECTED(Table) , [Date] >= minDate && [Date] <= maxDate ) ,
[Date] , 
"Value" ,
IF( [Date] = minDate , 1 , 1 + [Monthly Return] )
) , 
[Value]
)

 

Br,
J


Connect on LinkedIn

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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