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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Extending value of a measure forwards but not backwards

Hi,

 

I have a budget number (which is the summation of a column), and it stops with the most recent value. I want that number to extend to be a "forecasted budget", so I created a measure as such:

 

Forecasted Budget =

CALCULATE(SUM('Financial Data'[Total Notional Budget]), LASTDATE('Financial Data'[Accuracy Date]))
 
That date is linked to a calendar table in the background. I only want the numbers going forward from the "last date", but when I graph it the line goes all the way across (as it should)

 

Thanks for your help.

 

Vanlang

1 ACCEPTED SOLUTION

Hi @Anonymous,

First, please create a Date table and a measure as below. Then drag the date field in Date table and new created measure onto the visual:

Forecasted Budget = 
VAR _curval =
    CALCULATE (
        SUM ( 'Financial Data'[Total Notional Budget] ),
        FILTER (
            'Financial Data',
            'Financial Data'[Accuracy Date] = MAX ( 'Date'[Date] )
        )
    )
VAR _maxdate =
    CALCULATE ( MAX ( 'Financial Data'[Accuracy Date] ), ALL ( 'Financial Data' ) )
VAR _foreval =
    CALCULATE (
        SUM ( 'Financial Data'[Total Notional Budget] ),
        FILTER ( ALL ( 'Financial Data' ), 'Financial Data'[Accuracy Date] = _maxdate )
    )
RETURN
    IF ( MAX ( 'Date'[Date] ) <= _maxdate, _curval, _foreval )

Extending value of a measure forwards but not backwards.JPG

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@Anonymous , not very clear.

 

Try one of the formulae if this can work

 

CALCULATE(SUM('Financial Data'[Total Notional Budget]), filter(all(Date), Date[Date]>= LASTDATE('Financial Data'[Accuracy Date]))

or

CALCULATE(SUM('Financial Data'[Total Notional Budget]), filter(all(Date), Date[Date]>= LASTDATE('Financial Data'[Accuracy Date]), CROSSFILTER ( 'Financial Data'[Accuracy Date], Date[Date], NONE ))

Greg_Deckler
Super User
Super User

@Anonymous - Maybe something like:

 

Forecasted Budget =

CALCULATE(SUM('Financial Data'[Total Notional Budget]), MAX(ALL('Financial Data'[Accuracy Date])))

 

Hard to tell, Not really enough information to go on, please first check if your issue is a common issue listed here: https://community.powerbi.com/t5/Community-Blog/Before-You-Post-Read-This/ba-p/1116882

Also, please see this post regarding How to Get Your Question Answered Quickly: https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

The most important parts are:
1. Sample data as text, use the table tool in the editing bar
2. Expected output from sample data
3. Explanation in words of how to get from 1. to 2. 


@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
The Definitive Guide to Power Query (M)

DAX is easy, CALCULATE makes DAX hard...
Anonymous
Not applicable

Sorry, you're right, there is not a lot of information.

 

I have a table with financial information:

 

DateValue
November 1, 20195
November 1, 201910
October 1, 201912
October 1, 201913

 

When I graph the budget on a graph, it shows that for October the value is 25 and for November it is 15.

 

I don't have any December values. I want to create a measure that will show that the value for the budget is 15 in perpetuity going forward.

 

I have used the formula:

 

CALCULATE(SUM(Table[Value]), LASTDATE(Table[Date]))

 

However the issue is that it creates it as a line going backwards and forwards, so October is also 15, September is 15, but I only want December to be 15, etc etc.

 

I hope that clarifies things.

 

Thanks again

Hi @Anonymous,

First, please create a Date table and a measure as below. Then drag the date field in Date table and new created measure onto the visual:

Forecasted Budget = 
VAR _curval =
    CALCULATE (
        SUM ( 'Financial Data'[Total Notional Budget] ),
        FILTER (
            'Financial Data',
            'Financial Data'[Accuracy Date] = MAX ( 'Date'[Date] )
        )
    )
VAR _maxdate =
    CALCULATE ( MAX ( 'Financial Data'[Accuracy Date] ), ALL ( 'Financial Data' ) )
VAR _foreval =
    CALCULATE (
        SUM ( 'Financial Data'[Total Notional Budget] ),
        FILTER ( ALL ( 'Financial Data' ), 'Financial Data'[Accuracy Date] = _maxdate )
    )
RETURN
    IF ( MAX ( 'Date'[Date] ) <= _maxdate, _curval, _foreval )

Extending value of a measure forwards but not backwards.JPG

Best Regards

Rena

Community Support Team _ Rena
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi @v-yiruan-msft 

 

I cannot thank you enough for solving this!!! I have tried for days to solve it to no avail!

 

thank you a million times over!!! 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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