Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago

Calculation with non-visulated data

Hello together

 

Here is my initial situation:

 

Value DatePayment PCIRR PurchasedEffective Duration
24-Okt-2022-7'457'843.062.0192266.97
25-Okt-2022-14'827'458.331.36793213.28
25-Okt-2022-7'237'375.002.0274698.52
25-Okt-2022-17'468'035.651.35803912.31
26-Okt-2022-100'500'000.001.46471814.21
27-Okt-2022-6'982'216.671.28867211.41
23-Nov-2022-15'121'041.671.227285 
23-Nov-2022-161'291'111.111.227285 
06-Dez-2022-25'269'000.001.03711916.47
13-Dez-2022-2'454'739.681.3619158.56
13-Dez-2022-35'924'916.661.04918111.27
13-Dez-2022-2'484'160.001.0428811.41
15-Dez-2022-35'094'884.771.1279812.18
15-Dez-2022-30'135'718.181.1187718.72
19-Dez-2022-30'141'666.671.1093348.70
19-Dez-2022-35'303'666.661.07410812.16
28-Dez-2022-49'350'000.001.18610216.32

 

 

I have daily data here, sometimes 2 entries per day (cf. month of November).

in the end, i want to have this format:

 

 MV YieldDuration
DEZ-246'158'752.621.1112.42
NOV-176'412'152.781.230
OKT-154'472'928.711.4913.16

 

 

 

this is how the calculation works:

 

Value DatePayment PCPayment per monthWeighted Payment IRR PurchasedWeighted YieldValue DateEffective DurationWeighted Duration
23-Nov-2022-15'121'041.67-176'412'152.780.091.2272850.1123-Nov-2022 0
23-Nov-2022-161'291'111.11-176'412'152.780.911.2272851.1223-Nov-2022 

0

 

 

 

 

 

Payment per month = SUM(Payment PC)         | from a single month

Weighted Payment =divide(table[Payment PC] , table[Weighted Payment])

Weighted Yield = Table[Weighted Payment] * Table[IRR Purchased]

Weighted Duration = Table[Weighted Payment] * Table[Effective Duration]

 

for all calculations the daily values have to be used, but i only want to visualise the monthly results. the monthly yield is = sum(Weighted Yield). does anyone know if this is possible? Preferably with measures? As it should be dynamic when i apply e.g. filters and not all data is needed.

Thanks a lot!

 

2 Replies

  • The general mechanism is to create a summary table in a variable, which has the results of the measure at the day level, and then run an aggregation like SUMX or AVERAGEX over summary table. As an example, your weighted yield could be

    Weighted Yield Monthly =
    VAR SummaryTable =
        ADDCOLUMNS ( VALUES ( 'Date'[Date] ), "@value", [Weighted Yield] )
    VAR Result =
        SUMX ( SummaryTable, [@value] )
    RETURN
        Result
    

    Although I put monthly in the name of the measure, it would actually work at any granularity of date.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Sorry, but I have not been working with Power BI for long and I think the formulas I have written are wrong.

      I have already spent several hours with it and even with your approach I can't find a solution.