Weighted Average and Dynamic Indexing

Hi all,

I was wondering if any one can help me with a couple of DAX formula.

The first is weighted average - from doing some reading I see Sumx being floated as a way to do this.
My model is attached, which is just current base calculations is attached . Effectively I want to be able to calculate the weighted average Price to Book with filters on. The current formula I have seems to work when all the securities are selected but when I use the slicer the P/B add together cumulatively rather than give me a filtered W.A.

The second one is dynamic indexing:
I generally like to index different securities or FX pairs to 100 at a point in time. So in excelCapital Markets Report.pbix (3.7 MB) I would have the current value divided by the first value *100. In the slicer I want to be able to change the date and for the first date of the index to adjust to the first date in a slicer. Does anyone know how to do this?

Hi @Ronan, we aim to consistently improve the topics being posted on the forum to help you in getting a strong solution faster. While waiting for a response, here are some tips so you can get the most out of the forum and other Enterprise DNA resources.

  • Use the forum search to discover if your query has been asked before by another member.
  • When posting a topic with formula make sure that it is correctly formatted to preformatted text </>.
    image
  • Use the proper category that best describes your topic
  • Provide as much context to a question as possible.
  • Include the images of the entire scenario you are dealing with, screenshot of the data model, details of how you want to visualize a result, and any other supporting links and details.

I also suggest that you check the forum guideline How To Use The Enterprise DNA Support Forum. Not adhering to it may sometimes cause delay in getting an answer.

Please also check the How To Mask Sensitive Data thread for some tips on how to mask your pbix file.

Hi @Ronan, we’ve noticed that no response has been received from you since the 9th of January. We are waiting for the images of the entire scenario you are dealing with, and any other supporting links and details.

This will help other users and experts to answer your inquiry better. In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved.

hi i attached the full model. Not sure what else is needed for you to see the data I am working on

Hi Ronan

It seems your S&P500 table has several problems, particularly there are some repeated entries. My advice would be that you fix it using Power Query. I created a distinct table called SP500 but still observe some errors.

Anyway, I computed the weighted average in the following way:

New Weighted Average =
VAR MarketCapVar =
SUM ( SP500[CUR_MKT_CAP] )
RETURN
SUMX (
ADDCOLUMNS (
VALUES ( SP500[Identifier] ),
@Mkt”, [Sum of Market Cap],
“BPR”, [P/B to Market Cap]
),
DIVIDE ( [@Mkt], MarketCapVar ) * [BPR]
)

It would be easier if your S&P500 didn’t have those problems.

Best,

Diego

Thanks @diego,

I really appreciate your insight. Yes there was some errors alright, I think I may have fixed most of them but given the data sourcing it is hard.

Let me look at this formula and come back to you.

Thanks so much
Ronan

Hi @Ronan, did the response provided by @Diego help you solve your query? If not, how far did you get and what kind of help you need further? If yes, kindly mark the thread as solved. Thanks!

Hi @Ronan, we’ve noticed that no response has been received from you since the 21st of January. We just want to check if you still need further help with this post? In case there won’t be any activity on it in the next few days, we’ll be tagging this post as Solved. If you have a follow question or concern related to this topic, please remove the Solution tag first by clicking the three dots beside Reply and then untick the checkbox. Thanks!