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

Use slicer to filter column

I want to use my quarter year column as a slicer, when I select a single quarter year, the resulting outcome in the matrix table should give me the output as 'Selected quarter from the slicer and next two quarters' as shown in the below image. Can someone suggest any method or know the proper DAX for the following outcome?    

Forum.jpg

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

Hi , @Anonymous 

According to your description, you want to "Use slicer to filter column".

Here are the steps you can refer to:
(1)This is my test data:

vyueyunzhmsft_0-1673492401222.png

(2)We can click "New Table" to  create a date  table as a slicer:

Date = ADDCOLUMNS( 
CALENDAR(FIRSTDATE('Table'[Date]),LASTDATE('Table'[Date])),
"Year", YEAR ( [Date] ),
"Quarter", ROUNDUP(MONTH([Date])/3,0),
"Year_Quarter", year([date]) & "Q" & ROUNDUP(MONTH([Date])/3,0) 
)

And we do not create any relationship between two tables.

And in the raw visual i use a measure to show the value:

 

My Measure = SUM('Table'[Value])
 

(3)Then we can create a measure :

Measure Test = var _min_quarter_date = MIN('Date'[Date])
var _end_quarter_date = EOMONTH(_min_quarter_date ,8)
var _cur_date = MIN('Table'[Date])
return
IF(_cur_date>=_min_quarter_date && _cur_date <= _end_quarter_date , [My Measure] , BLANK())

(4)Then we can put the fields we need on the visual and we can meet your need:

vyueyunzhmsft_2-1673493044683.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

View solution in original post

4 REPLIES 4
v-yueyunzh-msft
Community Support
Community Support

Hi , @Anonymous 

According to your description, you want to "Use slicer to filter column".

Here are the steps you can refer to:
(1)This is my test data:

vyueyunzhmsft_0-1673492401222.png

(2)We can click "New Table" to  create a date  table as a slicer:

Date = ADDCOLUMNS( 
CALENDAR(FIRSTDATE('Table'[Date]),LASTDATE('Table'[Date])),
"Year", YEAR ( [Date] ),
"Quarter", ROUNDUP(MONTH([Date])/3,0),
"Year_Quarter", year([date]) & "Q" & ROUNDUP(MONTH([Date])/3,0) 
)

And we do not create any relationship between two tables.

And in the raw visual i use a measure to show the value:

 

My Measure = SUM('Table'[Value])
 

(3)Then we can create a measure :

Measure Test = var _min_quarter_date = MIN('Date'[Date])
var _end_quarter_date = EOMONTH(_min_quarter_date ,8)
var _cur_date = MIN('Table'[Date])
return
IF(_cur_date>=_min_quarter_date && _cur_date <= _end_quarter_date , [My Measure] , BLANK())

(4)Then we can put the fields we need on the visual and we can meet your need:

vyueyunzhmsft_2-1673493044683.png

 

Thank you for your time and sharing, and thank you for your support and understanding of PowerBI! 

 

Best Regards,

Aniya Zhang

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

 

Anonymous
Not applicable

Hey Aniya Zhang,
Thank you for replying. Your method works fine for numerical data.
If we compare our dataset ..you have Value in Numerical, whereas in my data the Values are in String Format. i can't use the 'My Measure' which has the SUM function.. any walkaround for the same ??

 

 

Hi, @Anonymous 

If you are using the "String" type of data, please use the "Max()" function:

MAX function (DAX) - DAX | Microsoft Learn

Mahesh0016
Super User
Super User

@Anonymous Can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

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.