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
Anonymous
Not applicable

Why does my dax filter show empty values that are not in the filter instead of hiding them?

Hello !  😁

I'm trying to filter values from a Column chart :

The chart looks like this :

ytiea

 

And I use a Slicer to filter values like this :

 

GJ3wv

 

The values are from a table Parametres

 

WjmDC

 

So here is my Selection_Date measure :

 

 

Selection Date = [DateFilter]

 


DateFilter is an other measure that choose how to filter the values (based on the slicer's selection).

 

 

DateFilter = 

var _today  = TODAY()
var _month  = MONTH(_today)
var _year   = YEAR(_today)
var _last_30_days = _today - 30 

return SWITCH(SELECTEDVALUE(Parametres[Selection_date]),
        "Last30Days", CALCULATE( SUM(v_revenues[qty]), FILTER(v_dates, v_dates[Date] > _last_30_days )),
        "MonthToDate", CALCULATE(SUM(v_revenues[qty]), FILTER(v_dates, v_dates[actual_month] = 1)),
        "YearToDate", CALCULATE(SUM(v_revenues[qty]), FILTER(v_dates, v_dates[actual_year] = 1))
        )

 

 

This measure works but I still have one problem. The filter is ok but when I filter a values (example month to date) all the value that are not in the selection (all the values that are not november 2021) are still visible but they are empty :

dC6lQ


cpKSN

So here is my question :

How can I add the values that are not in the selection ? How can I filter so it only display the values that are in the checked in the slicer ?

Per example, for Date to Month I want only this to be displayed 


XWMqT

Thank you for your help 

1 ACCEPTED SOLUTION
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could create a flag measure to calculate whether the value corresponding to each X-axis is 0. If it is 0, you can use Filter in Visual to filter it. I made a simple example:

1.in my data (0-5 months value is 0)

vyalanwumsft_0-1636425240818.png

2. set flag measure is not 0 .

vyalanwumsft_1-1636425256839.png

The final output is shown below:

vyalanwumsft_2-1636425313566.png

If not right, can you share a simple file or data?
Best Regards,
Community Support Team_ Yalan Wu
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

3 REPLIES 3
v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

Is your problem solved?? If so, Would you mind accept the helpful replies as solutions? Then we are able to close the thread. More people who have the same requirement will find the solution quickly and benefit here. Thank you.
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-yalanwu-msft
Community Support
Community Support

Hi, @Anonymous ;

You could create a flag measure to calculate whether the value corresponding to each X-axis is 0. If it is 0, you can use Filter in Visual to filter it. I made a simple example:

1.in my data (0-5 months value is 0)

vyalanwumsft_0-1636425240818.png

2. set flag measure is not 0 .

vyalanwumsft_1-1636425256839.png

The final output is shown below:

vyalanwumsft_2-1636425313566.png

If not right, can you share a simple file or data?
Best Regards,
Community Support Team_ Yalan Wu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

amitchandak
Super User
Super User

@Anonymous , You should create an independent  table with these values and then should measure , but if select a date, you can get more than date. So in that case we use independent date table for slicer and use the joined date table for datesytd and datesmtd

 

Need of an Independent Date Table:https://www.youtube.com/watch?v=44fGGmg9fHI

 

sales =
var _max = maxx(allselected('Date1'),'Date'[Date])
var _min = _max -30

return
calculate([Measure], filter('Date', 'Date'[Date] <=_max && 'Date'[Date] >=_min))

 

YTD =
var _max = maxx(allselected('Date1'),'Date'[Date])
var _min = date(year(_max),1,1)
var _day = _max
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _day) )


MTD =
var _max = maxx(allselected('Date1'),'Date'[Date])
var _min = eomonth(_max,-1) +1
var _day = _max
return
CALCULATE(sum('Table'[Qty]), FILTER(ALL('Date'),'Date'[Date] >=_min && 'Date'[Date] <= _day) )

 

MTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESMTD('Date'[Date]))

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD('Date'[Date],"12/31"))

 

 

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

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
Top Kudoed Authors