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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
HeihoSilver
Frequent Visitor

Chart shows all dates even with date slicer on

Hi, 

 

I have a DateTable using Calendar auto. The date slicer is based on this DateTable and is used as the main filter for other visualizations in the same page.

 

I have a separate table (Merged_SSU) and connected to DateTable, when I create a chart by dragging directly from the table and set with Count(Distinct) everything shows ok, but the problem is the chart doesn't show "0" when there is no data (the red line does not go down to 0), e.g. March 2020, or doesn't show "0" at all, e.g. December 2020 below (slicer date is between Jan 2020 - Jan 2021)

Tried to find "Shows items with no data" but couldn't find it in the options. 

 

HeihoSilver_2-1610536092781.png

 

Therefore, I create a new measures with the following code in order to show "0" 

_CountCaseNo = IF(DISTINCTCOUNT(Merged_ssu[CaseNo]) > 0,  
                    DISTINCTCOUNT(Merged_ssu[CaseNo]) , 0)

 

When I drag the above code into the same chart, the line is now with "0" but it shows all the dates from 2016 - 2025.

HeihoSilver_4-1610536708661.png

 

How to solve this issue if I want the chart to show the dates based on the date slicer only (Jan 2020 - Jan 2021)?

Appreciate for the help, thank you. 

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@HeihoSilver , Try like , assume date table giving range

 

0 between range
Measure = var _1= IF(DISTINCTCOUNT(Merged_ssu[CaseNo]) > 0,
DISTINCTCOUNT(Merged_ssu[CaseNo]) , 0)
var _min = minx(ALLSELECTED('Calendar'), 'Calendar'[Date])
var _max = maxx(ALLSELECTED('Calendar'), 'Calendar'[Date])
return
CALCULATE(if(max('Calendar'[Date]) <_min || max('Calendar'[Date]) >_max , BLANK(), _1))

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

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@HeihoSilver , Try like , assume date table giving range

 

0 between range
Measure = var _1= IF(DISTINCTCOUNT(Merged_ssu[CaseNo]) > 0,
DISTINCTCOUNT(Merged_ssu[CaseNo]) , 0)
var _min = minx(ALLSELECTED('Calendar'), 'Calendar'[Date])
var _max = maxx(ALLSELECTED('Calendar'), 'Calendar'[Date])
return
CALCULATE(if(max('Calendar'[Date]) <_min || max('Calendar'[Date]) >_max , BLANK(), _1))

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

@amitchandak  Thank you for the solution it works well 😊

 

After reading the doc about these functions I try to understand the logic behind the formula above, but I'm still not sure.

 

So the Date Slicer is formulated/referenced by the var _min or var_max? 

 

Then the Calculate formula use to evaluate each row (e.g. monthly) and to check if the max(calendar[date]) on each row is either less or higher than the slicer date, in which in this case return blank. 

 

ALLSELECTED (Removes context filters from columns and rows in the current query, while retaining all other context filters or explicit filters). Does it mean that it will evaluate each rows and use explisit filter such as date slicer?

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 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.

Top Solution Authors