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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
Anonymous
Not applicable

Matrix not filtered according to dates

Hi, I have a Year-Month slicer and a matrix showing the sales for each month. 

gandalf00_0-1628151952780.png

 

If i select 2021-March, I would like the matrix to show sales for January, February and March. However, it only shows the sales for 2021-March. 

 

How can i fix this? Thanks in advance! 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Make sure there's no active relationship between calendar table and the fact table. If the date slicer you are using is from the fact table, you will need to create another date table as slicer(to make sure the matrix won't be flitered by the slicer). Then create a measure like: 

measure = 
var matrix_month = month(selectedvalue('fact'[date]))
var slicer_month = month(selectedvalue('calendar'[date]))
var slicer_last2_month = month(edate(selectedvalue('calendar'[date]),-2))
return
if(matrxi_month <= slicer_month && matrix_month >= slicer_last2_month, 1, 0)

At last, put the measure to martrix visual filter where measure = 1.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.

View solution in original post

3 REPLIES 3
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Make sure there's no active relationship between calendar table and the fact table. If the date slicer you are using is from the fact table, you will need to create another date table as slicer(to make sure the matrix won't be flitered by the slicer). Then create a measure like: 

measure = 
var matrix_month = month(selectedvalue('fact'[date]))
var slicer_month = month(selectedvalue('calendar'[date]))
var slicer_last2_month = month(edate(selectedvalue('calendar'[date]),-2))
return
if(matrxi_month <= slicer_month && matrix_month >= slicer_last2_month, 1, 0)

At last, put the measure to martrix visual filter where measure = 1.

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
amitchandak
Super User
Super User

@Anonymous , if you this month year from a date table, You can use YTD

YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD("Date"[Date],"12/31"))
Last YTD Sales = CALCULATE(SUM(Sales[Sales Amount]),DATESYTD(dateadd("Date"[Date],-1,Year),"12/31"))

 

If you want trend, means want to show month

then

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

Anonymous
Not applicable

Hi, thanks for your answer, but I'm afraid this is not the solution I'm looking for.

 

Let's say I have 3 salesmen, namely ABC; and 2 types of sales,namely Sales and Backorder.

 

When I select March 2021 from my slicer, I would like my matrix to look like the table on the right, but instead the table on the left is what I'm currently stuck with. 

 

gandalf00_0-1628155827646.png

 May I know how can I fix this? Thank you?

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

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