Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
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.
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.
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.
Solved! Go to Solution.
@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))
@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))
@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?
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.