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
DonIncognito
Frequent Visitor

Slicer returning results outside date range

I have a date slicer hooked up to a date table. The slicer has two filters, one for anything after 1/1/2020, and one for choosing the end date using the date offset calculation.

 

If I have the beginning date selected, it feels like the slicer is returning all the results in the date table.

 

2020-11-16_15h06_47.png

 

If I move the start date to one day in the future, then the slicer works as per normal.

 

2020-11-16_15h07_07.png

 

Any ideas on why this is happening and how to fix it? This is on the desktop Version: 2.86.902.0 64-bit (October 2020)

7 REPLIES 7
DonIncognito
Frequent Visitor

Hi Janey

 

My date table is generated with the following query.

let
    Source = List.Dates(StartDate, Length, #duration(1, 0, 0, 0)),
    #"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
    #"Renamed Columns" = Table.RenameColumns(#"Converted to Table",{{"Column1", "Date"}}),
    StartDate = #date(2017, 7, 1),
    Today = DateTime.Date( DateTime.LocalNow()),
    Length = Duration.Days(Today - StartDate)+547,
    Custom1 = #"Renamed Columns",
    #"Fin Year Aus" = Table.AddColumn(Custom1, "Financial Year AUS",each Date.Year([Date]+#duration(184, 0, 0, 0))),
    #"Fin Month Aus" = Table.AddColumn(#"Fin Year Aus", "Financial Month AUS", each Number.Mod(Date.Month([Date])+6,12)),
    #"Inserted Year" = Table.AddColumn(#"Fin Month Aus", "Year", each Date.Year([Date]), Int64.Type),
    #"Inserted Month" = Table.AddColumn(#"Inserted Year", "Month", each Date.Month([Date]), Int64.Type),
    #"Inserted Month Name" = Table.AddColumn(#"Inserted Month", "Month Name", each Date.MonthName([Date]), type text),
    #"Inserted Day" = Table.AddColumn(#"Inserted Month Name", "Day", each Date.Day([Date]), Int64.Type),
    #"Inserted Day Name" = Table.AddColumn(#"Inserted Day", "Day Name", each Date.DayOfWeekName([Date]), type text),
    #"Inserted Day of Week" = Table.AddColumn(#"Inserted Day Name", "Day of Week", each Date.DayOfWeek([Date])+1, Int64.Type),
    #"Inserted Week of Month" = Table.AddColumn(#"Inserted Day of Week", "Week of Month", each Date.WeekOfMonth([Date]), Int64.Type),
    #"Inserted Week of Year" = Table.AddColumn(#"Inserted Week of Month", "Week of Year", each Date.WeekOfYear([Date]), Int64.Type),
    YYMM = Table.AddColumn(#"Inserted Week of Year", "YYMM", each ([Year]-2000)*100+[Month]),
    ID = Table.AddColumn (YYMM, "ID", each (Date.Year([Date]) - Date.Year(StartDate))*12 + Date.Month([Date])),
    #"Changed Type" = Table.TransformColumnTypes(ID,{{"Date", type date}, {"Financial Year AUS", Int64.Type}, {"Financial Month AUS", Int64.Type}, {"YYMM", Int64.Type}, {"ID", Int64.Type} }),
    #"Replaced Value" = Table.ReplaceValue(#"Changed Type",0,12,Replacer.ReplaceValue,{"Financial Month AUS"}),
    #"Extracted Date" = Table.TransformColumns(#"Replaced Value",{})
in
    #"Extracted Date"

 

I am using the Date column from that for my slicer, and it the second date column in the pictures given.

 

That date column is linked 1:many to the Date_Of_Order column with cross filtering set to single

 

2020-11-19_10h24_31.png

I have simplified it by taking out all information, other than the dates.

2020-11-19_10h25_54.png

2020-11-19_10h25_44.png

I get that if the date slicer has the entire range selected, then it wont filter the table. I just want to know if there is a way to configure the slicer or table so that it does.

 

Thanks again

Hugh

 

Hi, @DonIncognito 

 

The date range of your original date table is larger than the fact table. You can try to directly use the date of the fact table instead of the date table in the visual.

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

DonIncognito
Frequent Visitor

Hi @v-janeyg-msft

 

Thanks for your efforts, they are much appreciated, but it has not solved my issue. It got rid of the blank lines perfectly, but that was a side effect and not the main problem. I have cleaned up that issue, so now there are no lines with a blank date in them, but I'm still getting results returned from outside the dates set on the slicer.

 

2020-11-19_08h53_41.png2020-11-19_08h53_51.png

 

 

Hi, @DonIncognito 

 

The problem may occur elsewhere.Whether the 'date' of the date slicer and the 'date' in the table are in the same field or in different tables?

Could you mind providing some sample data or more information about the table like relationships,fields and measure?So we can help you soon.

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

v-janeyg-msft
Community Support
Community Support

Hi, @DonIncognito 

 

It’s my pleasure to answer for you.

According to your description,I think you can create a measure, then use it in filter pane.

Like this:

Measure = if(ISBLANK(MAX(Table1[date])),0,1)

gif.gif

If it doesn’t solve your problem, please feel free to ask me.

 

Best Regards

Janey Guo

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

DonIncognito
Frequent Visitor

So if I apply a filter to the date, it can still end up not being filtered? 2020-11-16_15h39_39.png

 

So whats happening is the visual itself is filtered to only show dates after 1/1/2020, but when the full range is selected, its not filtering the date range at all? Is there a way to configure it so that the slicer returns the intended set of dates?

 

 

amitchandak
Super User
Super User

@DonIncognito , When there is no date selected and entire range is used. it means date is not filtered. so you will see all dates. The reason you more data is that your date table does not have all the required dates. and you are seeing a null row on top because of that. 

Also refer this - https://blog.crossjoin.co.uk/2019/07/10/power-bi-slicers-show-values-that-do-not-exist/

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.