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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
venkb
Helper I
Helper I

Filter rows based on date column

hello, I have the following measure

 

Received_Today_1 = COUNTROWS(FILTER (
ALLSELECTED(Logs),
Logs[Date] = SELECTEDVALUE('Date Table'[Date]) - 1
&& Logs[State] = "State"
&& Logs[Status] = "Success"
))
 
Received_Today_1 is a measure and all i wanting is to count based on the above mentioned filter for selected date - 1. so in the slicer if is select a date of 11/18/2020 then i want this measure for 11/17/2020. 
 
btw when i remove the -1 from the above measure it gives me the count for 11/18/2020 but when i put -1 i expect it to give me the count for 11/17 but it doesnt. what am i missing here? thanks
4 REPLIES 4
venkb
Helper I
Helper I

here you go - i have a date slicer and i select a single date from it. based on the selection i am wanting to calculate the following measure. how many rows had a status & state of success and state respectively for

  • the selected date
  • selected date - 1
  • selected date - 2 and so on ie for the last 7 days of selected date

hope this helps

Anonymous
Not applicable

What is the reason to use ALLSELECTED? This function is used to get filters from outside the visual or get all the iterated entities from a visual. I have a strong feeling you're not using it correctly. And on top of that, this is the MOST complex function in all DAX and understanding it takes a bit of learning. Could you please explain better what you're trying to do? Maybe a picture would be useful...

venkb
Helper I
Helper I

thanks amitchandak, i tried the previousday function but it is still giving me the current day data. And yes the tables are linked through date.

 

btw, my goal is to for the last 7 days from the current date. so may need outside of previousday function even if it worked (sorry - i should have mentioned that in my original note)

amitchandak
Super User
Super User

@venkb , if date table is joined with the table then try like for previous day

Received_Today_1 = COUNTROWS(FILTER (
ALLSELECTED(Logs),
&& Logs[State] = "State"
&& Logs[Status] = "Success"
), previousday('Date Table'[Date]))

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
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

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