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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
slapdragon
Frequent Visitor

Two lines in a line chart - Stop both when one line stops having data and exclude zero values

This is something I am unable to figure out though I have gone through several posts on here. Need help please!

 

I have two tables. One that contains the solved dates, ticket numbers etc and the other table contains just dates from 2019 till 2021 with the corresponding custom period and week numbers that we follow:

 

slapdragon_0-1595490583049.png

 

I have a line graph where I have data for the total number of tickets solved in both 2019-20 and 2020-21 with two measures that I had created:

Total_Tickets_2019_2020 = CALCULATE([TotalTickets], FILTER(CustomWeek, CustomWeek[CustomYear] = "2019-20")) + 0
and
Total_Tickets_2020_2021 = CALCULATE([TotalTickets], FILTER(CustomWeek, CustomWeek[CustomYear] = "2020-21")) + 0

 

The X-axis a custom week number that we follow which is one of the columns in the above screenshot.

 

slapdragon_0-1595491723086.png

slapdragon_2-1595491796654.png

 

Here's the question:

1. How do I stop the current year from showing zero values past the date where we have no data for. Example - We are currently in Week21 and there is no data for the future dates (obviously), so I dont want it to show the line for the '0s' for the current year,

2. How do I not show last year's data and I would like to stop the last year's line where the data for the current year ends. I dont want the data for weeks past Week21 for the last year. I want it to show only for "this week last year", but this is a custom week number and not a calendar week.

 

Hope this isn't too much of an ask. Thanks in advance 🙂

1 ACCEPTED SOLUTION

Thank you both for the responses. I managed to fix the zero values as I removed the "+ 0" from the TotalTickets measure.

 

I am yet to understand the fix for my 2nd point though. I haven't been able to understand the info from the links specified.

View solution in original post

3 REPLIES 3
Anonymous
Not applicable

HI @slapdragon,

I'm not so sure how your total ticket calculated, can you please share some dummy data with your formula to help us clarify your scenario and test coding formula on it?

How to Get Your Question Answered Quickly 

Regards,

Xiaoxin Sheng

Thank you both for the responses. I managed to fix the zero values as I removed the "+ 0" from the TotalTickets measure.

 

I am yet to understand the fix for my 2nd point though. I haven't been able to understand the info from the links specified.

amitchandak
Super User
Super User

@slapdragon , you have added +0 that what is showing you those 0 data points.

For week refer

https://community.powerbi.com/t5/Community-Blog/Week-Is-Not-So-Weak-WTD-Last-WTD-and-This-Week-vs-La...

https://medium.com/@amitchandak.1978/power-bi-wtd-questions-time-intelligence-4-5-98c30fab69d3

 

Any weekday calendar

https://community.powerbi.com/t5/Community-Blog/Any-Weekday-Week-Decoding-Date-and-Calendar-2-5-Powe...

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors