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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
AmiraBedh
Resident Rockstar
Resident Rockstar

Create From To filters based on MMM-YYYY with condition

I want to create the following filters :

capalt_0-1635789341794.png

capalt_1-1635789366223.png

I want when I select a date from To I want that the selection From is bigger than the first.

How can I achieve that ?

 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696
1 ACCEPTED SOLUTION
amirabedhiafi
Impactful Individual
Impactful Individual

The simplest way is to create an error message when you select the To less than the From : 

 

FromToValue = IF( SELECTEDVALUE('yourTable'[FromDate]) > SELECTEDVALUE('yourTable'[ToDate])

                             ,"Invalid selection", "")

 

If you want the hard way : 

FromToValue = IF(CALCULATE('yourTable'[ToDate])>=SELECTEDVALUE('yourTable'[FromDate]) ),1,0)

 

Set the visual slicer:

amirabedhiafi_0-1635786589204.png

 

since the measure could not be applied it in the slicer,you need to use the measure in visual.

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini

View solution in original post

1 REPLY 1
amirabedhiafi
Impactful Individual
Impactful Individual

The simplest way is to create an error message when you select the To less than the From : 

 

FromToValue = IF( SELECTEDVALUE('yourTable'[FromDate]) > SELECTEDVALUE('yourTable'[ToDate])

                             ,"Invalid selection", "")

 

If you want the hard way : 

FromToValue = IF(CALCULATE('yourTable'[ToDate])>=SELECTEDVALUE('yourTable'[FromDate]) ),1,0)

 

Set the visual slicer:

amirabedhiafi_0-1635786589204.png

 

since the measure could not be applied it in the slicer,you need to use the measure in visual.

Amira Bedhiafi
Full Stack Business Intelligence Consultant @Capgemini

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

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

April Fabric Community Update

Fabric Community Update - April 2024

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