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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

Calculate Number of Days Based 2 Slicers

I have 2 slicers in my report, one with date (Date2), one with day name (DayName).  Both are coming from the same DimDate table.

 

I am trying to count the number of days selected based on the two slicers.  For example, if the date slicer is 8/5/19 to 8/9/19 and the day name slicer is Monday, Wednesday, Friday, then the count should be 3.  If there is no filter selected on the day name slicer, the count should be 5.  Below is what I have so far, but the result doesn't seem to be correct when I make a day name selection.  It is only correct and I leave day name deselected.

 

DayCounter = VAR FirstDay = CALCULATE(
MIN('DimDate'[Date2]),
ALLSELECTED('DimDate'[Date2])
)
VAR LastDay = CALCULATE(
MAX('DimDate'[Date2]),
ALLSELECTED('DimDate'[Date2])
)
RETURN
CALCULATE(
Count(DimDate[Date2]),DimDate[Date2] >= FirstDay, DimDate[Date2] <= LastDay, Holiday[IsHoliday]<>"Y"
)
1 REPLY 1
amitchandak
Super User
Super User

if it is from the same table, We are getting 3 (count of date) when we select there weekdays. Are we missing something?

The measure used is "Count of date".

Screenshot 2019-08-31 13.08.00.png

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
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 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