cancel
Showing results for
Did you mean:
Frequent Visitor

## Make Data Stop Showing in the Future

I have a yearly cumulative sales line chart, along with a projection, but right now both the sales and projection begin from day 1 and go to day 365. I want the cumulative sales to stop at the current day (rather than being flat for the rest of the year) and, ideally, for the projection to start at the current day.

This is how it looks now:

This is the sales measure:

IncentiveSum =
var yearnum = LOOKUPVALUE('dw dimDate'[YearNum],'dw dimDate'[FullDate], today())

RETURN

CALCULATE(sum('dw factSales'[NetSalesAmount]), filter(all('dw dimDate'), 'dw dimDate'[DayNumOfYear]<=max('dw dimDate'[DayNumOfYear])),'dw dimDate'[YearNum]=2022)

And this is the projection:

LineProjection =
var DayNum = LOOKUPVALUE('dw dimDate'[DayNumOfYear],'dw dimDate'[FullDate], today())
var YearCur = LOOKUPVALUE('dw dimDate'[YearNum],'dw dimDate'[FullDate], today())
var Yearsum = CALCULATE(sum('dw factSales'[NetSalesAmount]),'dw dimDate'[YearNum]=2022, removefilters('dw dimDate'[DayNumOfYear]))
RETURN

divide(Yearsum, DayNum, 0)*max('dw dimDate'[DayNumOfYear])

1 ACCEPTED SOLUTION
Super User

@Brotedo Maybe:

IncentiveSum =
var yearnum = LOOKUPVALUE('dw dimDate'[YearNum],'dw dimDate'[FullDate], today())

RETURN

IF(MAX('dw dimDate'[Date]) > TODAY(),BLANK(),CALCULATE(sum('dw factSales'[NetSalesAmount]), filter(all('dw dimDate'), 'dw dimDate'[DayNumOfYear]<=max('dw dimDate'[DayNumOfYear])),'dw dimDate'[YearNum]=2022))

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
2 REPLIES 2
Super User

@Brotedo Maybe:

IncentiveSum =
var yearnum = LOOKUPVALUE('dw dimDate'[YearNum],'dw dimDate'[FullDate], today())

RETURN

IF(MAX('dw dimDate'[Date]) > TODAY(),BLANK(),CALCULATE(sum('dw factSales'[NetSalesAmount]), filter(all('dw dimDate'), 'dw dimDate'[DayNumOfYear]<=max('dw dimDate'[DayNumOfYear])),'dw dimDate'[YearNum]=2022))

Become an expert!: Enterprise DNA
External Tools: MSHGQM
Latest book!:
Mastering Power BI 2nd Edition

DAX is easy, CALCULATE makes DAX hard...
Frequent Visitor

This works!

Announcements

#### CollabDays Lisbon - 26 November 2022

Sessions include practical, hands-on experience that will help you take the next step in your career and know-how.

#### Difinity Conference 2022

Difinity is the largest Microsoft Data, AI, Power BI, Power Platform and Business Applications Conference in New Zealand.

#### European Share Point Conference

This conference returns live and in-person in Copenhagen this 28 November-01 December with 4 Microsoft Keynotes, 9 Tutorials, and 120 Sessions.

#### Microsoft 365 Conference - 06-08 December

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Top Solution Authors
Top Kudoed Authors