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
admin11
Memorable Member
Memorable Member

How to remove target line from May till Dec 2021 ?

Hi All

I have sales vs target chart it work fine. 

I like to remove those target line from May till Dec , because May till Dec no sales yet , so don't need to display.

admin11_0-1619129454542.png

@Ashish_Mathur have share with me below code , it try to check if SALES_ is not blank , then compute the target line. 

TARGET_ = if(ISBLANK([SALES_]),BLANK(),SUM(TARGET_[TARGET]))

Since the sales vs target gap chart is using below expression :-

Target YTD =
var _max = today()
return
calculate(TOTALYTD(('TARGET_'[TARGET_]),'Date'[Date]),filter('Date','Date'[Date]<=_max))
So i try to convert the above expression to below :-
TARGET_YTD_ASHISG_ = if(ISBLANK([SALES_]),BLANK(),[Target YTD])
 
No error , but it does not work.
 
Hope some one can share with me where go wrong ?
 
My PBI file :-
 

Paul Yeo

1 ACCEPTED SOLUTION
samdthompson
Memorable Member
Memorable Member

Hello, I downloaded your pbix and replaced the Sales_YTD with this: It works for me

 

Sales YTD =

var _max = date(year(today())-0,month(today()),day(today()))
var val = TOTALYTD(('SALES'[SALES_]),dateadd('Date'[Date],-0,year),'Date'[Date]<=_max)
return
IF(TARGET_[TARGET_ASHISG_]=BLANK(),BLANK(),val)
 
 
// if this is a solution please mark as such. Kudos always appreciated.

View solution in original post

2 REPLIES 2
Ashish_Mathur
Super User
Super User

Hi,

I think this is happening because there is no relationship between the Source column of your Target Table and the Source column of your Source table.  I tried to create a relationship but could not.  Furthermore, i have also simplified some measures.  Download the PBI file from here.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/
samdthompson
Memorable Member
Memorable Member

Hello, I downloaded your pbix and replaced the Sales_YTD with this: It works for me

 

Sales YTD =

var _max = date(year(today())-0,month(today()),day(today()))
var val = TOTALYTD(('SALES'[SALES_]),dateadd('Date'[Date],-0,year),'Date'[Date]<=_max)
return
IF(TARGET_[TARGET_ASHISG_]=BLANK(),BLANK(),val)
 
 
// if this is a solution please mark as such. Kudos always appreciated.

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