Skip to main content
Showing results for 
Search instead for 
Did you mean: 

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Helper II
Helper II

Filter data in previous period

I have 2 donut charts.
The one on the left shows data in the specified period the users chooses. This period is selected using a date filter in the filter pane that affects all visuals in the same page.

The chart on the right should show the previous period of the first chart. For example, if the user selected the last week, then this second chart shows data for 2 weeks ago, if the user selects March 2020 then the chart should show data for February 2020...


I''ve been trying to get the 2 dates selected by the user: end and begin; calculate the number of days in between; and then trying to substract those days from the begin day and filter that data but so far this is not working.

Super User
Super User

Community Support
Community Support

Hi  @nanci


Create a slicer table as below:

Table 2 = VALUES('Table'[Date])

Then create 2 measures as below:

Measure = 
var _myslicer=CALCULATETABLE(VALUES('Table 2'[Date]),FILTER('Table 2','Table 2'[Date] in FILTERS('Table 2'[Date])))
var _mindate=MINX(_myslicer,'Table 2'[Date])
var _maxdate=MAXX(_myslicer,'Table 2'[Date])
Measure 2 = 
var _myslicer=CALCULATETABLE(VALUES('Table 2'[Date]),FILTER('Table 2','Table 2'[Date] in FILTERS('Table 2'[Date])))
var _mindate=MINX(_myslicer,'Table 2'[Date])
var _maxdate=MAXX(_myslicer,'Table 2'[Date])

And you will see:

Annotation 2020-08-17 174206.png

For the related .pbix file,pls see attached.


Best Regards,
Did I answer your question? Mark my post as a solution!
Super User
Super User

@nanci , you need to combine few calculations like for month, qtr , year like


Rolling 2 = CALCULATE(distinctcount(Transation[Month-Year]),DATESINPERIOD('Date'[Date],today(),-2,MONTH))


for week


How to handle the condition

Helpful resources

Europe Fabric Conference

Europe’s largest Microsoft Fabric Community Conference

Join the community in Stockholm for expert Microsoft Fabric learning including a very exciting keynote from Arun Ulag, Corporate Vice President, Azure Data.

July 2024 Power BI Update

Power BI Monthly Update - July 2024

Check out the July 2024 Power BI update to learn about new features.

July Newsletter

Fabric Community Update - July 2024

Find out what's new and trending in the Fabric Community.