Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

Sum by group By and Max

Hello guys,

 

I know there are a lot a posts about that but I don't understand any of them a now I am lost with all these daxes fx; calculate, sumx, allexcept, summarize...

 

I just want to sum row sby group and max date and I don't succeed  to achieved that  following  any  post I have red.

 

So imagine: I have for each day few rows about a portfolio who containes instruments. It is a fact table so every day the sum of the market value of my portfolio is changing. If I sum instruments value today (let's say = 100k) tomorrow it could be 140K. What  I want is something like : sum market value group by portfolio name and max date. The sum of each instrument group by portfolio where date is the last one.

 

I tried but I don't understand the logic in dax measure :/

 

Thx a lot for helping me to achieve that.

 

 

  •  

    please lok into the caluclated formula. it may help 

11 Replies

  • v-piga-msft's avatar
    v-piga-msft
    Icon for Resident Rockstar rankResident Rockstar

    Hi Anonymous ,

    More details could help us understand your scenario better.

    If it is convenient, could you share some sample data and your desired output so that we could help further on it.

    Best  Regards,

    Cherry

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hi v-piga-msft 

      Thx for your answer! I found a part of the solution but still stuck to do something.Unfortunatly I cannot share data with you ( asset management client's data are really sensitive) but I will try to be as clear as spossible :)

       

      So imagine a fact table with few columns -> DATE - FK_PORTFOLIO- FK ISNTRUMENT- MARKET VALUE

      Everyday I recieve a position for each portfolio and portfolio has one or many instruments into it. And each instrument has a market value... look at the picture below  I create a trivial case of my problem but it should help I think.

       

      What I want to summarize is the black part beacause it shows my lastest portfolio position with its sum market value =142.

       

      In fact the first dashboard of my report show the lastest ( newest) position for a choosen portfolio and should be not affected by any slicer.

       

      I hope it help you for helping me.

       

      Thx a lot,

       

      J.

      • mussaenda's avatar
        mussaenda
        Icon for Community Champion rankCommunity Champion
         
         
        Current Day Value = 
        VAR currentYear =
         YEAR ( TODAY () ) 
        RETURN
         CALCULATE (
         [New Orders],
         FILTER(ALLSELECTED(Your table here where date column is), YEAR(Your Date Here) = currentYear && Your Date Here = TODAY()))
        
        
        Kindly check if this will work