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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
JustDavid
Helper I
Helper I

Extend Line Chart to end of x-axis using previous period ending balance

Power BI Gurus,

 

Given the "sample" columnar final table view, notice that I have 2 attributes - '5YP Cost' and 'Net Posting'.

 

There will only be 1 instance for attribue '5YP' and 12 instances of 'Net Postings' for each group

 

Given that my fiscal year starts in Jun and ends in May, thus, my '5YP Cost' and 'Net Posting 01' will start in the month of Jun 1, 202x.

'Net Posting 02' will be Jul 1, 202x, 'Net Posting 03' will be Aug 1, 202x' etc, with 'Net Posting 12' to be May 1, 202x+1 where x is a number.

 

Currently my chart is showing "correctly" due to my current table output.

 

I'm happy with my 5YP chart as it charts out the linear from Jun to May.

 

However, my 'Net Postings' are not what I desired. From Aug to May, it charts out 0 (due to my table value). What I'd like here is to show the continuation from the previous (which in this case is July).

 

In other words. If I have [Date] is greater than EDATE(today's date) and that the [Value] is 0, then I need to pick up from my previous period's value.


Sample of Columnar tableSample of Columnar tableChart View with desired resultChart View with desired result

 

Below is my DAX for the Y-axis

5YP = 
    VAR _Date = MAX(tblDate[Calendar Date])
    VAR _tbl = FILTER(ALLSELECTED('CombineProformaPF-and-5YP'), 'CombineProformaPF-and-5YP'[Date] <= _Date && 'CombineProformaPF-and-5YP'[Attributes] = "5YP Cost" 
                                )
RETURN 
    SWITCH(TRUE(), 
        ISBLANK([cumulativePostings] ), BLANK(), 
        CALCULATE([SumValue], _tbl)
    )

 

Revised Budget = 
    SWITCH(TRUE(),
    AND(ISINSCOPE(tblDCHierarchy[Lv1_ShowDetail]), ISBLANK(VALUES(tblDCHierarchy[Lv1_ShowDetail]))) || 
    AND(ISINSCOPE(tblDCHierarchy[Lv2_ShowDetail]), ISBLANK(VALUES(tblDCHierarchy[Lv2_ShowDetail]))) || 
    AND(ISINSCOPE(tblDCHierarchy[Lv3_ShowDetail]), ISBLANK(VALUES(tblDCHierarchy[Lv3_ShowDetail]))) || 
    AND(ISINSCOPE(tblDCHierarchy[Lv4_ShowDetail]), ISBLANK(VALUES(tblDCHierarchy[Lv4_ShowDetail]))), BLANK(),
    CALCULATE([SumValue], 'CombineProformaPF-and-5YP'[Attributes] = "Revised Balance"))

 

1 REPLY 1
lbendlin
Super User
Super User

Familiarize yourself with the concept of LASTNONBLANK, and then use that (or its pedestrian equivalent) in your measure.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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