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

Earn the coveted Fabric Analytics Engineer certification. 100% off your exam for a limited time only!

Reply
dinoscool3
Helper I
Helper I

Dynamic date filtering by column?

I have data with registrations for the past two years, each registration is attached to a group and I've created a matrix with how many registrations each group has.

 

I want to next create a matrix with each column showing registrations by group in X days, 30, 60, 90, 6 months, etc. I know I can do a dynamic filter but that effects the entire table.

 

I've tried creating measures for each column but the DAX expressions aren't returning what I want it to. For example, when I try DATEINPERIOD I get an error because there are date repeats. I've tried a few others to filter but it doesn't seem to work.

 

For example:

 

 

 

Measure 2 = CALCULATE(COUNT('Schools over 5registrations'[email]),DATESINPERIOD('Schools over 5 registrations'[created_at],TODAY(),-1,MONTH))

 

 

 

 

Any ideas for a DAX expression to do dynamic filtering for each column?

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@dinoscool3 , You should use date table for time intelligence

 

Measure 2 = CALCULATE(COUNT('Schools over 5registrations'[email]),DATESINPERIOD('SDate'[Date],TODAY(),-1,MONTH))

 

 

 

before joining make sure created_at do not have timestamp , other wise create a date first

 

example

Date = [datetime].date
or
Date = date(year([datetime]),month([datetime]),day([datetime]))

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

View solution in original post

1 REPLY 1
amitchandak
Super User
Super User

@dinoscool3 , You should use date table for time intelligence

 

Measure 2 = CALCULATE(COUNT('Schools over 5registrations'[email]),DATESINPERIOD('SDate'[Date],TODAY(),-1,MONTH))

 

 

 

before joining make sure created_at do not have timestamp , other wise create a date first

 

example

Date = [datetime].date
or
Date = date(year([datetime]),month([datetime]),day([datetime]))

To get the best of the time intelligence function. Make sure you have a date calendar and it has been marked as the date in model view. Also, join it with the date column of your fact/s. Refer :radacad sqlbi My Video Series Appreciate your Kudos.

Helpful resources

Announcements
April AMA free

Microsoft Fabric AMA Livestream

Join us Tuesday, April 09, 9:00 – 10:00 AM PST for a live, expert-led Q&A session on all things Microsoft Fabric!

March Fabric Community Update

Fabric Community Update - March 2024

Find out what's new and trending in the Fabric Community.