The ultimate Fabric, Power BI, SQL, and AI community-led learning event. Save €200 with code FABCOMM.
Get registeredCompete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.
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!
Also, when I removed the connection between the tables, I just get a line for every week that has the total from the beginning.
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.
Create a measure as follows
Measure = CALCULATE(SUM(Data[Value]), FILTER(Data, [Date] >= MIN('Date'[Date]) && [Date] <= MAX('Date'[Date])))
Output:
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.
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.
Before, I had something like below, which is closer, but I don't want to see the other data when a year is selected.
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:
no relationship between two tables
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)
2. create a measure to calculate the count of ID
count = COUNTX(FILTER(Data, [Measure filter] = 1), [ID])
Output:
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.