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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
MelissaRegnaud
New Member

Show a Zero for data within a date range that is not there?

Hello There!

 

A question regarding data within a date range slider. If I have data /records for dates 1 Jan , 2 Jan and 5 Jan for incidents that occur and no data for 4 Jan , is there a way to show this as 0 on the visualisation layer that 0 Incidents happened on that date if its not in the data? Something like within the date range of 31 Dec - 30 Jan ( as the slider) if no Date show 0 Value? 

 

I received the suggestion to add it into the data as in every single day that there is no incident add it in and make  it 0 for that date in the data file?

I would however prefer to have the change in the visual layer, If ..then... else... kinda of solution? rather than within the data file ? 

 

Best regards

Melissa

1 ACCEPTED SOLUTION
v-yulgu-msft
Employee
Employee

Hi @MelissaRegnaud,

 

Please create a calendar table first. Establish an active relationship between these two tables.

calendar = CALENDAR(DATE(2016,12,1),DATE(2017,5,31))

Add 'calendar'[date] into slicer. Add 'calendar'[date] and incident column into table visual. Enable to "show item with no data".

2.PNG

 

With this method, you can show blank for those records with no data. But cannot display a "0".

 

To display a "0", I think you have to add it into table view rather than visual layer.

Create a calculated table like below, and add columns from this table into slicer and table visual.

New table =
UNION (
    'Incident data',
    ADDCOLUMNS (
        EXCEPT ( VALUES ( 'calendar'[Date] ), VALUES ( 'Incident data'[Date] ) ),
        "incident", 0
    )
)

3.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yulgu-msft
Employee
Employee

Hi @MelissaRegnaud,

 

Please create a calendar table first. Establish an active relationship between these two tables.

calendar = CALENDAR(DATE(2016,12,1),DATE(2017,5,31))

Add 'calendar'[date] into slicer. Add 'calendar'[date] and incident column into table visual. Enable to "show item with no data".

2.PNG

 

With this method, you can show blank for those records with no data. But cannot display a "0".

 

To display a "0", I think you have to add it into table view rather than visual layer.

Create a calculated table like below, and add columns from this table into slicer and table visual.

New table =
UNION (
    'Incident data',
    ADDCOLUMNS (
        EXCEPT ( VALUES ( 'calendar'[Date] ), VALUES ( 'Incident data'[Date] ) ),
        "incident", 0
    )
)

3.PNG

 

Best regards,

Yuliana Gu

Community Support Team _ Yuliana Gu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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