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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
dhslxop
Frequent Visitor

Line Chart with 0s and Slicer

Hello!

I am trying to create a line chart that shows a count of a specific category filter, that includes zeros on the chart, based on a slicer date value. I have my table (Data) with all of the data connected (many to one) to a table (Dates) with all of the dates. The slicer is based on the dates table and selects a range (year > month > date). 

 

I have a measure to get a 1 or a 0 based on if the date in data is in the range selected. 

 

Measure Filter = 
If(SELECTEDVALUE('Data'[Start of Week]) >= MIN('Date'[Date]),1,0)

 

 I also have a measure to get the 0 values. 

 

Measure Count = COUNT('Data'[Incident])+0

 

 When I remove Measure Filter, I get the 0 values, but the range isn't there. When I add the Measure Filter, the 0s go away. 

 

Is there a way to do this? Thanks!

4 REPLIES 4
dhslxop
Frequent Visitor

Also, when I removed the connection between the tables, I just get a line for every week that has the total from the beginning.

 3.PNG

Anonymous
Not applicable

Hi @dhslxop 

 

I would like to apologize for the belated reply.

 

I modified the sample data and did the following test, I hope it can help you.

 

vxuxinyimsft_0-1722822667899.png

 

vxuxinyimsft_1-1722823313513.png

 

Create a measure as follows

Measure = CALCULATE(SUM(Data[Value]), FILTER(Data, [Date] >= MIN('Date'[Date]) && [Date] <= MAX('Date'[Date])))

 

Output:

vxuxinyimsft_3-1722823447194.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

dhslxop
Frequent Visitor

Thanks - I appreciate the assistance. This didn't quite do it. 

This created something like this - which isn't showing any of the 0 values for the weeks that have 0. 

2.PNG

Before, I had something like below, which is closer, but I don't want to see the other data when a year is selected. 

 

1.PNG

Anonymous
Not applicable

Hi @dhslxop 

 

Do you need to count the number of incident for a specified date range? And then need the line chart to show only data within a specified date range?

 

If this is the case, try the following.

 

My sample data:

vxuxinyimsft_0-1720591284651.png

 

vxuxinyimsft_1-1720591389908.png

 

no relationship between two tables

vxuxinyimsft_2-1720591426226.png

 

1. Create a measure and put the measure into the visual-level filters, set up show items when the value is 1.

Measure filter = IF(MAX([Date]) >= MIN('Date'[Date]), 1, 0)

 

vxuxinyimsft_3-1720591626020.png

 

2. create a measure to calculate the count of ID

count = COUNTX(FILTER(Data, [Measure filter] = 1), [ID])

 

Output:

vxuxinyimsft_4-1720591819488.png

 

If I have misunderstood you, please provide some sample data and the expected results based on the sample data so that I can help you better. How to provide sample data in the Power BI Forum - Microsoft Fabric Community Or show them as screenshots or pbix. Please remove any sensitive data in advance. If uploading pbix files please do not log into your account.

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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