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
fern7
New Member

Removing months from slicer with no data

Hi All,

 

I have a table that I have uploaded to powerBI with dates ranging from begininning of July till end of November. I had put a slicer on the dashboard in dropdown view. However months from Jan - June have no data. Is there a way for the slicer to show the viewer of the dashboard only options July - November instead of showing all the months?

4 REPLIES 4
gmsamborn
Super User
Super User

Hi @fern7 

 

Would a measure like this help?  You can filter your visual with this.

 

_Include = 
VAR _CurrDt = SELECTEDVALUE( 'Date'[Date] )
VAR _MinDt =
    CALCULATE(
        MIN( 'FactTable'[Date] ),
        ALL( 'FactTable'[Date] )
    )
VAR _MaxDt =
    CALCULATE(
        MAX( 'FactTable'[Date] ),
        ALL( 'FactTable'[Date] )
    )
RETURN
    IF(
        _CurrDt >= _MinDt
            && _CurrDt <= _MaxDt,
        1
    )

 

 

SELECTEDVALUE( may have to be replaced with MAX( depending on how you intend to use it.

 

o_belov
Advocate I
Advocate I

@fern7 

How did you get the names of the months from the dates?
Do you use an auxiliary calendar table of type dimDate in the model?

If you use month from auxiliary calendar table, then create measure for slicer, like

IsDateInScope =
     IF(SELECTEDVALUE(financials[Date]) IN VALUES(dimDate[Date]), 1, 0)

add it in filter pane for slicer and choose is 1
o_belov_0-1702923760939.png

 

o_belov
Advocate I
Advocate I

@fern7 ,
You've done some transformations of your dates?
First - try unselect "Show items with no data".

o_belov_0-1702921782888.png

 

@o_belov 

That option is unchecked and it still shows the months with no data.

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.