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

Filter to date selected on slicer

Hello all, I want to count leads that were created from beginning of the month till date I selected on slicer.
I have filtered whole page to current month. I have measure like this:
 
m_Lead =
VAR selected_date = SELECTEDVALUE('CalendarAuto'[Date])
RETURN
CALCULATE(
COUNT('Lead'[LeadId]);
FILTER('CalendarAuto';'CalendarAuto'[Date] <= selected_date
))
It doesnt return any values. When I replace " <= selected_date " with e.g " datevalue("10/08") " it shows data I want.
Please tell me what do I need to do?
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Oki my collegue found solution, I just needed to add extra limit on data to the month + another calculate. Now everything counts as it should. Anyway thanks for your help!

 

m_Lead =
VAR selected_date = SELECTEDVALUE('CalendarAuto'[Date])
RETURN
CALCULATE(
CALCULATE( COUNT('Lead'[LeadId]);
'CalendarAuto'[Date] <= selected_date && 'CalendarAuto'[Date] >= DATE(YEAR(selected_date);MONTH(selected_date);1)

View solution in original post

4 REPLIES 4
ibarrau
Super User
Super User

Hi, what kind of slicer are you using for dates? 

SELECTEDVALUE will return data only if you are just selecting ONE value. If there are more than one it won't return values. You can try MAX or MIN for the date if you are using a range o selecting more than one.

 

Regards, hope this helps

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


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

Happy to help!

LaDataWeb Blog

Anonymous
Not applicable

I am using regular slicer. I have single option ON.

 

When I put jus SELECTEDVALUE into measure and click on various dates then values are changing.

 

 

Can you upload a picture of the slicer visualization and the return value of a measure containing SELECTEDVALUES ( Table[Date] )???


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

Happy to help!

LaDataWeb Blog

Anonymous
Not applicable

Oki my collegue found solution, I just needed to add extra limit on data to the month + another calculate. Now everything counts as it should. Anyway thanks for your help!

 

m_Lead =
VAR selected_date = SELECTEDVALUE('CalendarAuto'[Date])
RETURN
CALCULATE(
CALCULATE( COUNT('Lead'[LeadId]);
'CalendarAuto'[Date] <= selected_date && 'CalendarAuto'[Date] >= DATE(YEAR(selected_date);MONTH(selected_date);1)

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.