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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Filtering a line chart

Hi Everyone,

 

I’m just starting with Power BI and have a problem with a line chart that I hope someone will be able to help with.

The chart shows Sales Margin by Employee/Month and is filtered by Customer, Employee and Job Date.

 

I have a measure to calculate Margin as follows

 

Margin = IF(ISBLANK( [Profit]/SUM('Job Ledger'[Total Price])),0,[Profit]/SUM('Job Ledger'[Total Price]))

 

It has the IF ISBLANK replace with 0 as I want to show a data point for each month for the employee.

 

This works fine except when I use SELECT ALL in the Employee slicer and I get a line for every employee not just the ones who have been working on a job for the customer. I understand logically why it’s happening but I can’t seem filter the employees out don’t relate to that customer having tried various measures without success.

 

I’d be grateful for any advice on how I can do this.

 

Many thanks

 

Sample File : Example.pbix 

1 ACCEPTED SOLUTION
tex628
Community Champion
Community Champion

Hi @Anonymous ,

Try this:

Margin = 
IF(
ISBLANK( CALCULATE( [Profit]/SUM('Job Ledger'[Total Price]) , ALLSELECTED('Calendar'[Date])), BLANK(),
IF(
ISBLANK( [Profit]/SUM('Job Ledger'[Total Price])),
0,
[Profit]/SUM('Job Ledger'[Total Price])))


Let me know how it goes! 

Br, 
J


Connect on LinkedIn

View solution in original post

2 REPLIES 2
tex628
Community Champion
Community Champion

Hi @Anonymous ,

Try this:

Margin = 
IF(
ISBLANK( CALCULATE( [Profit]/SUM('Job Ledger'[Total Price]) , ALLSELECTED('Calendar'[Date])), BLANK(),
IF(
ISBLANK( [Profit]/SUM('Job Ledger'[Total Price])),
0,
[Profit]/SUM('Job Ledger'[Total Price])))


Let me know how it goes! 

Br, 
J


Connect on LinkedIn
Anonymous
Not applicable

Hi

 

Thanks so much. Works perfectly and a valuable lesson for me.

 

Best regards

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.