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

SELECTEDVALUE AS FILTER

Good afternoon everyone,

 

I have a table named (main) with two columns(date1 and date2), we could say date1 is the starting date and date2 is the finishing one.

 

Also, I have a date table I have created to connect the data from the main table to this one.

 

The purpose of my question is the next: 

 

I want to create a date filter where I can range the dates and count the rows from the main table which have the dates (date1 and date2) between the dates I have selected. Up to this point, everything is right I'm obtaining the results I'm looking for.

 

But everything change when I want to count the rows from the main table whose date1 dates are < date selected in the filter..

 

I have tried the following DAX: 

RESULTS < =
VAR SELECTEDM = SELECTEDVALUE('CALENDAR'[Date])
RETURN
COUNTROWS(FILTER('MAIN';'MAIN'[DATE1]<SELECTEDM))
 
DAX  function is working but it's not throwing back the correct result 
 
Any help?
 
Kind Regards,
 
Adrian
1 ACCEPTED SOLUTION
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could try the following DAX:

RESULTS < =
VAR SELECTEDM =
    MINX ( ALLSELECTED ( 'CALENDAR'[Date] ); 'CALENDAR'[Date] )
RETURN
    COUNTROWS ( FILTER ( 'MAIN'; 'MAIN'[DATE1] < SELECTEDM ) )

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

View solution in original post

1 REPLY 1
v-eachen-msft
Community Support
Community Support

Hi @Anonymous ,

 

You could try the following DAX:

RESULTS < =
VAR SELECTEDM =
    MINX ( ALLSELECTED ( 'CALENDAR'[Date] ); 'CALENDAR'[Date] )
RETURN
    COUNTROWS ( FILTER ( 'MAIN'; 'MAIN'[DATE1] < SELECTEDM ) )

 

Community Support Team _ Eads
If this post helps, then please consider Accept it as the solution to help the other members find it.

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.