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

Replace slicer Filter with FILTER() in DAX

Hey guys,

 

I am counting status updates for projects based on Status Dates with Filter on the side (slicer), with this measure :

IvyM_0-1638893894263.png

 

For some reasons i would like to not use the slicer, but use the FILTER() function, while putting fixed dates (I am aware it's a downgrade).

I want to add this :

FILTER('SNOW - Complete Status Report', 'SNOW - Complete Status Report'[Status Date]> "15/11/2021" && 'SNOW - Complete Status Report'[Status Date]< "03/12/2021"

on the line where I do COUNT(), but COUNT() takes only a column into account, can't do other functions I think ?

 

I want to say: count me the status updates for projects in this table, while having these dates range in mind.

 

I am really struggling with this thing, hopefully someone will enlighten me !

Thanks in advance

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Not very clear. A measure like

 

countrows(FILTER('SNOW - Complete Status Report', 'SNOW - Complete Status Report'[Status Date]> date(2021,11,15)  && 'SNOW - Complete Status Report'[Status Date]< date(2021,12,03) ))

 

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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@amitchandak 
Thank you very much for the inspiration ! 🙂
By using
countrows(FILTER('SNOW - Complete Status Report', 'SNOW - Complete Status Report'[Status Date]> date(2021,11,15)  && 'SNOW - Complete Status Report'[Status Date]< date(2021,12,03) ))
I saw that COUNTROWS() accepts only a table, thus it didn't recognize my column Status Date.

Finally, I found KEEPFILTERS() and combine it with COUNTROWS() in my measure.
* well I had to adapt it because KEEPFILTERS() accepts 1 filter at a time, but I chose only one date, not an interval. For my case it's acceptable

 

But you synthax for date worked very well !
This works for me (maybe it can help others) :

IvyM_0-1638961993539.png

 


amitchandak
Super User
Super User

@Anonymous , Not very clear. A measure like

 

countrows(FILTER('SNOW - Complete Status Report', 'SNOW - Complete Status Report'[Status Date]> date(2021,11,15)  && 'SNOW - Complete Status Report'[Status Date]< date(2021,12,03) ))

 

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

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.