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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
doingmeheadin
Frequent Visitor

Dax Measure that counts total rows for rows in filter context and gives a 0 for those outside of fil

Hi there, 

Currently when I use my slider to adjust the date parameters for a column chart dates that are outside of the filter context  disappear from the visual. I would like these dates outside of the paramenters of the slicer to remain but display and value of 0 (these figures would change dynamically as teh slider moved). I think this would be achieved by building a formular that can be used to count rows for dates within the filter contect set by a slider and for dates outside the silder reutrn 0.  For instance:

Outside of date filter? =
Var maxdate = MAX('Date Table'[Date Value])
Var mindate = Min('Date Table'[Date Value])
Var appointmentdate = MIN('Date Index'[Date of Appointment])
Return
CALCULATE(
IF(appointmentdate > maxdate || appointmentdate < mindate , 1, 0),
CROSSFILTER('Date Table'[Date Value], Appointments[Date of Appointment], None))

Then using this measure to power : 

Filtered jobs 0 =
CALCULATE(
IF([Outside of date filter?] = 1 , 0 , COUNTROWS(Appointments)),
CROSSFILTER('Date Table'[Date Value],Appointments[Date of Appointment], None))


This does not have the effect I am lookign for. Would anyone have suggestions of how to build this? 

2 REPLIES 2
Anonymous
Not applicable

Hi @doingmeheadin ,

In order to make troubleshooting and give you a suitable solution, could you please provide some sample data in your tables 'Date Table', 'Date Index' and 'Appointments(exclude sensitive data) with Text format and your expected result with backend logic and special examples? And is there any relationship among these tables? If yes, please provide the related info. It is better if you can share a simplified pbix file. You can refer the following link to upload the file to the community. Thank you.

How to upload PBI in Community

Best Regards

amitchandak
Super User
Super User

@doingmeheadin , You need group by to filter measure

 

example

 

COUNTROWS(Filter(values(Appointments[ID]), [Outside of date filter?]  =1) )

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 community update carousel

Fabric Community Update - June 2025

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