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

Filter a Date in a Fact Table with a Date Slicer from a non related Date Table

I'm crearing a Dashboard that when you slect a Date in a slicer you atomatically get a Graph with the latest N Months in the past, but I need that the silcer also filters my tables so I can show only data form the slected Date.

For example, if I filter December 2019, I want my Matrixs and Pie chart to show data only from December 2019 and my Line chart should show me from December 2019 to November 2018.

 

PBI2.png

 

As you can see I could make a Line chart that correctly shows Dates from December 2019 to November 2018. In order to create that I follow the steps from Parker Stevens (https://bielite.com/blog/last-12-months-from-selected-date-trailing-12-months-ttm/) that suguets to create a disconnected date table in order to manage filters in the graph. But using this method of a disconnected date table doesn't filters the Matrixs and Pie chart I have.

It may sound obvious, but if I try to relate my Date Table with my Fact Table now I can filter my Matrixs and Pie Chart, but my Line chart does not filter the way I want:

 

PBI3.png

Is there a way to filter the date from my Fact Table with the value I choose from silcer with the Date Table without being related? I tried to use SELECTEDVALUE but it's not giving me the desire result.

Thanks in advance for your help!

 

2 REPLIES 2
v-chuncz-msft
Community Support
Community Support

@Anonymous 

 

You may take a look at the following posts.

 

Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thank you very much @v-chuncz-msft 

It seems to be working but now I have another problem, inside my Matrixs I'm using SAMEPERIODLASTYEAR for calculating Growth and Power BI returns: Function 'SAMEPERIODLASTYEAR' expects a contiguous slection when the date column is not unique, has gaps or contains time portion. I think is because the measure in the Visual Level FIlters is only filtering one date, the selected one, so I tried to include both dates, the selected one and the one from last year like this:

 

 

Slicer = 
VAR Slicer =
    SELECTEDVALUE('Date'[Date])
VAR FactTable =
    MAX('Flat Files FlexView'[Date])
VAR SlicerLastPeriod =
    EDATE(Slicer,-12)
VAR FactTableLastPeriod =
    EDATE(FactTable,-12)
RETURN 
    IF
    (
        OR
        (
            Slicer = FactTable,
            SlicerLastPeriod = FactTable
        ),
        1,
        0
    )

 

 

But this is not working for my calculations in my Matrixs.

 

Thanks in advance!

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.