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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
Usefulinfo
Helper I
Helper I

Filtering a visual to display data for dates prior to min date of date range filter

Hi All,

 

Need your help to resolve below query.

 

I have a date range filter visual and a table visual whcih shows app details (app_name, received date etc). I want to show app count along with app details for only thoes app which has received_date < min (date). 

 

The below measure is giving correct result if I am adding REMOVEFILTERS('DateTable') but in this case the table visual shows all the received date irrespective of date filter visual bcz of REMOVEFILTERS which I dont want.

 

If I delete this line from measure then it give blank result bcz of date range filter, it couldn't find any received date less than min date of filter.

ShowApplication =
VAR MinFilterDate =
    CALCULATE(
        MIN('Date Table'[Date]),
        ALLSELECTED('Date Table')
    )
RETURN
CALCULATE(
    COUNTROWS('App'),
    REMOVEFILTERS('DateTable'),
    'App'[Received_Date] < StartDate
 
I have tried multiple approach but coldn't resolved this. Could you please guide me to achieve this.
3 ACCEPTED SOLUTIONS
rajendraongole1
Super User
Super User

Hi @Usefulinfo - To achieve this, you can avoid using REMOVEFILTERS by focusing on maintaining the date context from the filter visual. Instead of removing filters, we can use ALLSELECTED with a condition to include only dates earlier than the minimum selected date in the filter

 

 

ShowApplication =
VAR MinFilterDate =
CALCULATE(
MIN('Date Table'[Date]),
ALLSELECTED('Date Table')
)
RETURN
CALCULATE(
COUNTROWS('App'),
KEEPFILTERS('App'[Received_Date] < MinFilterDate)
)

 

hope this gives you correct app count with date filter. please check





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





View solution in original post

@Usefulinfo since you use ReceivedDate as Key column for Calendar relationship, modify your solution to this:

CALCULATE(
    COUNTROWS('Sheet2'),
    DateTable[Date] < StartDate, -- the change is here, using Date column from calendar instead RecievedDate
    -- and also here, since it's different table you have to add these filter as new parameter, so split by comma
    ISBLANK('Sheet2'[Despatch_Date]) &&
    'Sheet2'[Status] <> "close"
    )



vojtechsima_0-1730659128861.png

 

View solution in original post

Yes, I have all these details. I have tested again and its working fine. 

 

Thank you so much for your help.

View solution in original post

14 REPLIES 14
Usefulinfo
Helper I
Helper I

@vojtechsima ,Thank you for your reply.

I have calender table and another table app. There is many to one relationship b/w datetable[date] and app [received_date]. I need to show app details (name, received_date, valid date etc) for only thoes app which has received date < min(datetable[date]) in table visual.

 

This min(datetable[date]) should be calculated from date range filter 

Usefulinfo_0-1730651294935.png

 

 

 

@Usefulinfo 
I am trying to recreate your setup:

vojtechsima_0-1730652806805.png

and it works just fine, make sure you add the Measure to the table visual.

Perhaps, you can share some sample .pbix and I can work directly on that one.

@vojtechsima , I have created sample file but seems like dont have permission to attcahed the pbix file. 

 

Usefulinfo_0-1730656853818.png

 

Table visual 'Without_Keepfilter' giving correct result but received date is showing all date(not lesser date).

OpenApplicationBeforeFilterDate withoutfilter =
VAR StartDate =
    CALCULATE(
        MIN('DateTable'[Date]),
        ALLSELECTED('DateTable')
    )
RETURN
CALCULATE(
    COUNTROWS('Sheet2'),
     'Sheet2'[Received_Date] < StartDate &&
    ISBLANK('Sheet2'[Despatch_Date]) &&
    'Sheet2'[Status] <> "close" )
Usefulinfo_1-1730657078382.png

 

Table visual WithKeepfilter show blank for condition 'Sheet2'[Received_Date] < StartDate.

OpenApplicationBeforeFilterDate =
VAR StartDate =
    CALCULATE(
        MIN('DateTable'[Date]),
        ALLSELECTED('DateTable')
    )
RETURN
CALCULATE(
    COUNTROWS('Sheet2'),
    KEEPFILTERS( 'Sheet2'[Received_Date] < StartDate &&
    ISBLANK('Sheet2'[Despatch_Date]) &&
    'Sheet2'[Status] <> "close" ))
Usefulinfo_3-1730657313277.png

 

 

 -------------

I couldn't keep additional condition along with the solution you have suggested.

@Usefulinfo since you use ReceivedDate as Key column for Calendar relationship, modify your solution to this:

CALCULATE(
    COUNTROWS('Sheet2'),
    DateTable[Date] < StartDate, -- the change is here, using Date column from calendar instead RecievedDate
    -- and also here, since it's different table you have to add these filter as new parameter, so split by comma
    ISBLANK('Sheet2'[Despatch_Date]) &&
    'Sheet2'[Status] <> "close"
    )



vojtechsima_0-1730659128861.png

 

@vojtechsima , Thank you so much for your suggesion. 

I did same but didn't get same result. It really look weired. 

Usefulinfo_0-1730660013767.png

I will check once again if I am missing something. 

 

@Usefulinfo 
I am sending you my file in case:
smallerThanReceivedDateMinDate.pbix

make sure you have correct relationship, datatable is setup as calendar, you have full year of the calendar and you use calendar as the Slicer, those are general rules.

Yes, I have all these details. I have tested again and its working fine. 

 

Thank you so much for your help.

@Usefulinfo 
Thank you, feel free to mark the right answer as solution and I wouldn't mind kudos. thx

Usefulinfo
Helper I
Helper I

@rajendraongole1 , still geting blank result 😞 

 

vojtechsima
Resident Rockstar
Resident Rockstar

Hello, @Usefulinfo ,

if you have calendar (if you don't I suggest you create one), simple one-liner should work just fine.

 

 

 

display = 
CALCULATE(
    COUNTROWS('Table'),
    'Calendar'[Date] <= MIN('Calendar'[Date])
)

 

 

vojtechsima_0-1730650313454.pngvojtechsima_1-1730650320308.png

 

Usefulinfo
Helper I
Helper I

@rajendraongole1 , thank you for your reply. I tried this as well but it give blank result for condition 'App'[Received_Date] < MinFilterDate. 

Its showing correct result for greater condition.

 'App'[Received_Date] > MinFilterDate. 

 

Could you please suggest to fix this for 'App'[Received_Date] < MinFilterDate.  as well?

Hi @Usefulinfo - To troubleshoot and ensure that only records with Received_Date less than MinFilterDate are counted. slight update on previous measure. please check below one. using ALLSELECTED

 

ShowApplication =
VAR MinFilterDate =
CALCULATE(
MIN('Date Table'[Date]),
ALLSELECTED('Date Table')
)
RETURN
CALCULATE(
COUNTROWS('App'),
FILTER(
ALLSELECTED('App'),
'App'[Received_Date] < MinFilterDate
)
)





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





rajendraongole1
Super User
Super User

Hi @Usefulinfo - To achieve this, you can avoid using REMOVEFILTERS by focusing on maintaining the date context from the filter visual. Instead of removing filters, we can use ALLSELECTED with a condition to include only dates earlier than the minimum selected date in the filter

 

 

ShowApplication =
VAR MinFilterDate =
CALCULATE(
MIN('Date Table'[Date]),
ALLSELECTED('Date Table')
)
RETURN
CALCULATE(
COUNTROWS('App'),
KEEPFILTERS('App'[Received_Date] < MinFilterDate)
)

 

hope this gives you correct app count with date filter. please check





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!





@rajendraongole1 , Thank you. This works too

Helpful resources

Announcements
ArunFabCon

Microsoft Fabric Community Conference 2025

Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.

December 2024

A Year in Review - December 2024

Find out what content was popular in the Fabric community during 2024.