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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AMS_Pag
Frequent Visitor

Check the upper bound of a slicer and compare it to current date

Hi,

I've a slicer based on a date column (STOCK_START_DATE) and I'm trying to pick up the upper bound of this slicer set by the user, in a dynamic fashion (if the user changes the upper bound this would be "sensed"). After picking up the value of the upper bound I need to compare it to the current the date, and if it is less than the current date I have to "trigger" another filter to filter out the record based on another column (I need to trigger the filter "STOCK_TYPE <> 'Coming').

Is this possible to do? If yes, can you explain me how, please?

Thank you very much!

3 REPLIES 3
v-lili6-msft
Community Support
Community Support

hi @AMS_Pag 

You could use IF Function to create a conditional measure.

For example:

IF(MAX(STOCK_START_DATE) >Currentdate, <expression>,CALCULATE(<expression> FILTER(Table,"STOCK_TYPE <> 'Coming')))

 

If you still have problem, please share your sample data and your expected output.

Please see this post regarding How to Get Your Question Answered Quickly:
https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Regards,

Lin

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

Hi @v-lili6-msft,

thank you very much for your response.

I've created this measure:

COMING_FILTER = IF(MAX(FT_STOCK_VIEW[STOCK_START_DATE]) < TODAY(), COUNTROWS(FILTER(FT_STOCK_VIEW, FT_STOCK_VIEW[STOCK_STOCK_TYPE] <> "Coming")), FALSE)
 
(when the max STOCK_START_DATE is less then today then apply the specified filter, otherwise do nothing)
 
Is it correct?
If yes, what should I do now with this new measure? I tried to drag and drop it into the page filters box but it seems that the measure wouldn't fit in that box...
 
Thank you again for your support.
 
Regards

hi @AMS_Pag 

You may use measure like below:

COMING_FILTER = IF(MAX(FT_STOCK_VIEW[STOCK_START_DATE]) < TODAY(), COUNTROWS(FILTER(FT_STOCK_VIEW, FT_STOCK_VIEW[STOCK_STOCK_TYPE] <> "Coming")), BLANK())

And measure could not be set in page filters box and it could only be drag into visual filters box and it is not blank.

If you still have problem ,please share a simple sample pbix file and your expected output.

https://community.powerbi.com/t5/Community-Blog/How-to-Get-Your-Question-Answered-Quickly/ba-p/38490

 

Regards,

Lin

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

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.