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
Brotedo
Helper I
Helper I

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:

Brotedo_0-1665157726274.png

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
Greg_Deckler
Super User
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))

@ 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...

View solution in original post

2 REPLIES 2
Greg_Deckler
Super User
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))

@ 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...

This works!

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.