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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
joen12ac
Frequent Visitor

Small Multiples - Keep time series on X-axis while filtering on sales in past 12 months

Hi everyone,

Use case
I am trying to build a small multiples chart that only displays combinations of countries and products where there has been at least one sale in the past 12 months.

 

Challenge

However, when I apply the below filter measure, the x-axis is automatically also filtered on the past 12 months. I want the x-axis to be unaffected by the filter and show the full time series.

To exemplify, I want the x-axis to display sales from 2019 for the combinations of countries and products that have had at least one sale between today and 2022-08-24.

Measure

VAR SalesPastYear =

CALCULATE(

    [Sales],

    FILTER(

    date,

    date [date] >= TODAY() - 360 &&

    date [date] <= TODAY()

),

ALL(date)

)

RETURN

IF(SalesPastYear >0,1,0)

2 REPLIES 2
joen12ac
Frequent Visitor

@amitchandak Thanks for getting back to me.

Based on your input and the youtube video I created the below filter measure. However, when I apply it as a filter to the visual, the x-axis in the small multiples still is filtered to the past 12 months. The purpose of the filter is to identify which combinations of countries and products have had any sales in the past 12 months, but the small multiples should still display the full date range. 


CountryProductsWithSalesPast12Months =

var _max = maxx(allselected(Date2), Date2[Date])

var _min = eomonth(_max, -12) +1

var TotalSalesLast12Months =

calculate( [Sales], filter(Date, Date[Date] >=_min && Date, Date[Date <=_max))

 

RETURN

IF(TotalSalesLast12Months>0,1,0)

 

amitchandak
Super User
Super User

@joen12ac , if you want a trend there should not be a filter on the page. If there is a filter then it should be on an independent table

 

//Date1 is independent Date table, Date is joined with Table
new measure =
var _max = maxx(allselected(Date1),Date1[Date])
var _min = eomonth(_max, -12) +1
return
calculate( sum(sales[Gross Sales]), filter('Date', 'Date'[Date] >=_min && 'Date'[Date] <=_max))

 

 

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

 

Join us as experts from around the world come together to shape the future of data and AI!
At the Microsoft Analytics Community Conference, global leaders and influential voices are stepping up to share their knowledge and help you master the latest in Microsoft Fabric, Copilot, and Purview.
️ November 12th-14th, 2024
 Online Event
Register Here

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.