Forum Discussion

gmasta1129's avatar
gmasta1129
Resolver I
4 years ago

Month End Value

 
 

Hello,

 

I am having trouble with a formula to pull in the end of month value.  

 

There are 4 columns in my spreadsheet

 

1) Portfolio ID

2) Period End 

3) NAV

4) Run Date

 

I need to pull each period end (3/31/2022, 4/30/2022, 5/31/2022 etc.) which can be found in column 2.  Note: I do not need the values for Period End 5/20/2022 or 4/22/2022 which is also on my report.  Only last day of month.  This report is run on a daily basis and the Run date can be found under Run Date column 4.  (see my data below)

 

I need to pull the latest date (Run Date) period end NAV value.  For example. the latest Run date you will see 3/31/2022 Period End date is on Run Date 5/13/2022 therefore that NAV value and period end date needs to pull into my table.  And the latest Run date you see 4/30/2022 Period End is on Run Date 6/21/2022 therefore that NAV value and period end date needs to pull into my table.  Lastly, the latest Run date you see 5/31/2022 Period End is on Run Date 6/24/2022 therefore that NAV value and period end date needs to pull into my table. 

 

**This can change from day to day.  For example, as of 6/25/2022 (tomorrow) run date the period end can go back to 4/30/2022 and then i would need that NAV value for that period end date since it is the latest

 

 Port Id         Period End       NAV         Run Date

766253213/31/202216,544,61204/26/2022
766253213/31/202216,544,61204/27/2022
766253213/31/202216,544,61204/28/2022
766253214/22/202219,801,37204/29/2022
766253214/22/202219,801,37205/02/2022
766253214/22/202219,801,37205/03/2022
766253213/31/202216,544,61205/04/2022
766253213/31/202216,544,61205/05/2022
766253214/30/202219,635,79005/06/2022
766253214/30/202219,635,79005/09/2022
766253214/30/202219,635,79005/10/2022
766253214/30/202219,635,79005/11/2022
766253213/31/202216,544,61205/12/2022
766253213/31/202216,544,61205/13/2022
766253215/31/202220,617,24805/17/2022
766253215/31/202220,617,24805/18/2022
766253215/31/202220,617,24805/19/2022
766253215/31/202220,617,24805/20/2022
766253215/31/202220,617,24805/23/2022
766253214/30/202219,630,89005/24/2022
766253214/30/202219,630,89005/25/2022
766253215/20/202219,453,28205/26/2022
766253215/20/202219,453,28205/27/2022
766253215/20/202219,453,28205/30/2022
766253215/20/202219,453,28205/31/2022
766253214/30/202219,630,89006/01/2022
766253214/30/202219,630,89006/02/2022
766253214/30/202219,630,89006/06/2022
766253214/30/202219,630,89006/07/2022
766253214/30/202219,630,89006/08/2022
766253215/31/202219,414,87206/09/2022
766253215/31/202219,414,87206/10/2022
766253215/31/202238,829,74406/13/2022
766253214/30/202219,630,89006/14/2022
766253214/30/202219,630,89006/15/2022
766253214/30/202219,630,89006/16/2022
766253214/30/202219,630,89006/17/2022
766253214/30/202219,630,89006/21/2022
766253215/31/202219,416,46606/22/2022
766253215/31/202219,416,46606/23/2022
766253215/31/202219,416,46606/24/2022

 

 

 

Please see below for what my table/report should look like after the updates mentioned above...

 

Period EndNAV
3/31/202216,544,612
4/30/202219,630,890
5/31/202219,416,466

 

3 Replies

  • gmasta1129,

     

    Try this solution.

     

    Create calculated columns:

     

    Is Period End = IF ( FactTable[Period End] = EOMONTH ( FactTable[Period End], 0 ), 1 )
    Latest Run = 
    VAR vLatestRun =
        CALCULATE ( MAX ( FactTable[Run Date] ), ALLEXCEPT ( FactTable, FactTable[Period End] ) )
    VAR vResult =
        IF ( FactTable[Run Date] = vLatestRun, 1 )
    RETURN
        vResult

     

    Create measure:

     

    Period End NAV = 
    CALCULATE (
        SUM ( FactTable[NAV] ),
        FactTable[Is Period End] = 1,
        FactTable[Latest Run] = 1
    )

     

     

  • Hello, Thank you for the quick reply,  When i enter the formulas above into Power BI Desktop, 5/31/2022 is the only NAV value that shows up.  I need the NAV values for each month end.  

     

     

    • DataInsights's avatar
      DataInsights
      Icon for Super User rankSuper User

      gmasta1129,

       

      If you could share your pbix (remove confidential data) via a file service like OneDrive, I'll take a look.