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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Hiding Future dates in line Graph

Hi Experts

 

I am trying not to plot future values as into my line graph as i get zero on the line plot as i have no data for those dates. When i use the following DAX

CurrentYear =
VAR CurrentYearSales =
CALCULATE ( SUM ( 'Test Data_'[cr03a_reportscrimemade] ), 'Test Data_'[IsCurrentYear] = TRUE () )
RETURN
IF ( CurrentYearSales = BLANK (), 0, CurrentYearSales )
 
However, if i amend my DAX too
CurrentYear =
VAR CurrentYearSales =
CALCULATE ( SUM ( 'Test Data_'[cr03a_reportscrimemade] ), 'Test Data_'[IsCurrentYear] = TRUE (),
FILTER(
ALLSELECTED( 'Test Data_'),
[cr03a_period] <=TODAY()
)
)
RETURN
IF ( CurrentYearSales = BLANK (), 0, CurrentYearSales )
 
I get a constant line showing the previous month value 
 
I want the merasure to plot only two data point Jan 21 and Feb 21 as i only have data for those month so far...

 

1 ACCEPTED SOLUTION
PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Download sample PBIX with data and charts

 

If you could supply some data that would help understand what you are working with.  

You say you have no data for March onwards.  Do you mean you have rows with dates for March but no sales values in those rows?  Or you actually have no rows for any date after the end of Feb?

 

To plot Sales up to the current month use this measure

 

Sales Up to This Month = CALCULATE(SUM(Table1[Sales]), FILTER('Table1', MONTH('Table1'[Date]) <= MONTH(TODAY())))

 

 

lstm.png

 

To plot data up to the previous month use this measure

 

Sales Up to Last Month = CALCULATE(SUM(Table1[Sales]), FILTER('Table1', MONTH('Table1'[Date]) <= MONTH(TODAY()) - 1 ))

 

lastm.png

 

Regards

Phi



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


View solution in original post

2 REPLIES 2
PhilipTreacy
Super User
Super User

Hi @Anonymous 

 

Download sample PBIX with data and charts

 

If you could supply some data that would help understand what you are working with.  

You say you have no data for March onwards.  Do you mean you have rows with dates for March but no sales values in those rows?  Or you actually have no rows for any date after the end of Feb?

 

To plot Sales up to the current month use this measure

 

Sales Up to This Month = CALCULATE(SUM(Table1[Sales]), FILTER('Table1', MONTH('Table1'[Date]) <= MONTH(TODAY())))

 

 

lstm.png

 

To plot data up to the previous month use this measure

 

Sales Up to Last Month = CALCULATE(SUM(Table1[Sales]), FILTER('Table1', MONTH('Table1'[Date]) <= MONTH(TODAY()) - 1 ))

 

lastm.png

 

Regards

Phi



Did I answer your question? Then please mark my post as the solution.
If I helped you, click on the Thumbs Up to give Kudos.


Blog :: YouTube Channel :: Connect on Linkedin


Proud to be a Super User!


Anonymous
Not applicable

Hi Phil

 

See test file.....link... I just want to plot the two datapoint for 2021, as i only have data for two month 2020 is a correct plot.

the measure needs tweeking..

https://www.dropbox.com/s/59xfqa9nzedh1q0/sample.pbix?dl=0 

 

Kindly just post a new measure..

not a new file...

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors