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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
jn123
Frequent Visitor

Slicer that filters a measure based on selection

Hi there, 

 

I am trying to write a SWITCH dax that allows me to filter a table of dates whenever I have "Previous Period" selected on a slicer. 

 

I have a date column, and a measure: 

Measure = IF(MIN('.Compare Date'[Date]) >= [Previous Period MIN] && MAX('.Compare Date'[Date]) <= [Previous Period MAX], 1 , 0)
 
jn123_0-1714757821835.png

 

 I also have a table that has a column of what I'd like to have as options in my slicer, "Previous Period"
 jn123_1-1714757911164.png

 

Now here's where I am stuck... I have written out a second measure that should filter the table when "Previous Period" is selected, but it doesn't appear to be doing anything. The data doesn't change whether I have "Previous Period" selected or not.... HELP!
 
jn123_2-1714759565770.png

 

Thanks in advance!!

1 ACCEPTED SOLUTION
ExcelMonke
Super User
Super User

Consider the following single measure:

Measure = 

VAR _Current = Your calculation
VAR _Previous = Your calculation

RETURN
SWITCH (
    SELECTEDVALUE ( 'Compare date Slicer'[Slicer Selection] ),
    "Current Period", _Current,
    "Previous Period", _Previous,
    0
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

1 REPLY 1
ExcelMonke
Super User
Super User

Consider the following single measure:

Measure = 

VAR _Current = Your calculation
VAR _Previous = Your calculation

RETURN
SWITCH (
    SELECTEDVALUE ( 'Compare date Slicer'[Slicer Selection] ),
    "Current Period", _Current,
    "Previous Period", _Previous,
    0
)




Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors