cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

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
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors
Top Kudoed Authors