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
Kopek
Helper IV
Helper IV

Dax Time ineligence measure issue

Hi Everyone!

 

I do have a problem with creating a proper DAX measure.

I have created DAX calendar, where relationship to my Manager Raitings tab is done.

Based on that calendar i extracted Quarter and Year indicator, which is a filter on my canvas.

I do also have a separate period filter which indicates 3 mths ago, 1 year ago, 3 years ago...

Now, i need to count how many managers where marked as buy, hold or sell in given time period (e.g 3 mnths ago, 1 year ago, 3 years ago) based on quarter and year choosen in the slicer on canvas.

example.jpg

 

 

 

So, e.g if i date slice i choose Q2 2019, and in the period slicer i choose 3mths ago i want to know how managers where classified in Q1 2019.

 

I have created below measure: ( that one is an 3mths example, but i used the same pattern for 1 year, 3yrs, etc...

 

3Mth = calculate(COUNT('Manager Ratings'[Status]),DATESINPERIOD('Calendar'[Date],TODAY(),-3,MONTH))

 

and just know i realized that it counts everything based on TODAY date, not date choosen on canvas slicer.

Could you please help me and let me know how TODAY should be replaced in the measure, so that it takes into considiration date choosen on the page ?


Below is example of my calendar tab if needed:

 

DateMonthMonthOrderQuarterQuarter + YearYearPrevQDatePrevQEoq
23-Apr-15Apr4Q2Q2 2015201523-Jan-15Q1 201530 June 2015
24-Apr-15Apr4Q2Q2 2015201524-Jan-15Q1 201530 June 2015
25-Apr-15Apr4Q2Q2 2015201525-Jan-15Q1 201530 June 2015
26-Apr-15Apr4Q2Q2 2015201526-Jan-15Q1 201530 June 2015
27-Apr-15Apr4Q2Q2 2015201527-Jan-15Q1 201530 June 2015
28-Apr-15Apr4Q2Q2 2015201528-Jan-15Q1 201530 June 2015
29-Apr-15Apr4Q2Q2 2015201529-Jan-15Q1 201530 June 2015
30-Apr-15Apr4Q2Q2 2015201530-Jan-15Q1 201530 June 2015
1-May-15May5Q2Q2 201520151-Feb-15Q1 201530 June 2015
2-May-15May5Q2Q2 201520152-Feb-15Q1 201530 June 2015
3-May-15May5Q2Q2 201520153-Feb-15Q1 201530 June 2015
4-May-15May5Q2Q2 201520154-Feb-15Q1 201530 June 2015
5-May-15May5Q2Q2 201520155-Feb-15Q1 201530 June 2015
6-May-15May5Q2Q2 201520156-Feb-15Q1 201530 June 2015
7-May-15May5Q2Q2 201520157-Feb-15Q1 201530 June 2015
8-May-15May5Q2Q2 201520158-Feb-15Q1 201530 June 2015
9-May-15May5Q2Q2 201520159-Feb-15Q1 201530 June 2015
10-May-15May5Q2Q2 2015201510-Feb-15Q1 201530 June 2015
11-May-15May5Q2Q2 2015201511-Feb-15Q1 201530 June 2015
12-May-15May5Q2Q2 2015201512-Feb-15Q1 201530 June 2015
13-May-15May5Q2Q2 2015201513-Feb-15Q1 201530 June 2015
14-May-15May5Q2Q2 2015201514-Feb-15Q1 201530 June 2015
15-May-15May5Q2Q2 2015201515-Feb-15Q1 201530 June 2015
16-May-15May5Q2Q2 2015201516-Feb-15Q1 201530 June 2015

 

Thanks in advance!

1 ACCEPTED SOLUTION
v-diye-msft
Community Support
Community Support

Hi @Kopek 

 

Try something like this:

3Mth = calculate(COUNT('Manager Ratings'[Status]),DATESINPERIOD('Calendar'[Date],max('Calendar'[Date]),-3,MONTH))

 

if not help, please kindly share yor dummy pbix.

 

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

View solution in original post

2 REPLIES 2
v-diye-msft
Community Support
Community Support

Hi @Kopek 

 

Try something like this:

3Mth = calculate(COUNT('Manager Ratings'[Status]),DATESINPERIOD('Calendar'[Date],max('Calendar'[Date]),-3,MONTH))

 

if not help, please kindly share yor dummy pbix.

 

Community Support Team _ Dina Ye
If this post helps, then please consider Accept it as the solution to help the other members find it more
quickly.
amitchandak
Super User
Super User

@Kopek , for rolling try like

Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(Sales[Sales Date]),-12,MONTH))
Rolling 12 = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],max(Sales[Sales Date]),-12,MONTH))  
Rolling 12 till last 12 month = CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],ENDOFMONTH(dateadd(Sales[Sales Date],-12,month)),-12,MONTH))

Rolling 3= CALCULATE(sum(Sales[Sales Amount]),DATESINPERIOD('Date'[Date],staroffmonth(Sales[Sales Date]),3,MONTH))

Rolling 7 days = CALCULATE(sum(Sal[Sales Amount]),DATESINPERIOD('Date'[Date],max(Sales[Sales Date]),-7,Day))  

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.