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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Rsanjuan
Advocate III
Advocate III

Help needed for DAX rolling calculation

Last60Days = IF(AND([Date] >= [Today]-60, [Date] <= [Today]),1,0)

 

Capture.JPG

I am trying to calculate the rolling number of completed and planned meetings.  

 

For the completed meetings, I'm trying to calculate the number of meetings in the past 60 days, while the planned meetings I'm trying to calculate the planned meetings in the future.  I believe I got the past 60 days calculation correct, but it's totaling wrong with the "61".  Also, I am not sure how to do the calculation for the planned meetings.

 

I had invoked a table using the script found here:

 

http://www.mattmasson.com/2014/02/creating-a-date-dimension-with-a-power-query-script/

 

If someone could help me with the DAX formula, that would be great!  Thanks!

 

 

11 REPLIES 11
Nhallquist
Helper V
Helper V

What formula are you using to count the number of meetings in the past 60 days?  Are you counting the date, or a unique meeting identifier.  Ideally, you want to count the Index.  If you don't have one, you can always try Sum(Last60Days).  Then you would be adding a 1 for every meeting occurrance.  

 

For meetings in the future, I would stay with what you did for Meetings past, and do something like...

 

FutureMeetingFlag=If([Date]>Today(), 1,0)

 

Then you can use Sum([FutureMeetingFlag])

 

Let  us know if this resolves the issue, 

 

Nate

@Nhallquist

 

thanks for the reply.  I don't have a separate formula to count the number of meetings in the past 60 days.  

 

In the field "status" there are two types;  Completed Meetings and Planned Meetings.

 

I just set the rows for the account person and the columns to the "status" field.  I used the 60day calculation as a visual filter. 

 

I will try your suggestions.  Thanks!

@Nhallquist

 

I tried the future formula, it seems to work, but it's a bit off.  The actual data has 4, but it's only showing 3.  And it is totaling wrong 😞

 

Capture.JPGCapture2.JPG

Please post your formulas.  This will help me understand what is going on better.

 

Thanks,

 

Nate

@Nhallquist

 

Here are the formulas I have:

 

In the calendar table that I invoked, I have the following added columns:

 

FutureMeeting = If([Date]>Today(), 1,0)

Last60Days = (IF(AND([Date] >= [Today]-60, [Date] <= [Today]),1,0))

 

In the calendar table, I also have this measure:   Today = DATE(YEAR(NOW()),MONTH(NOW()),DAY(NOW()))

 

In the meeting report table, I have the following measures added:

 

Completed Meetings = CALCULATE(COUNTROWS('Meeting Report'), 'Meeting Report'[Status]="Completed Meetings")

Planned Meetings = CALCULATE(COUNTROWS('Meeting Report'),'Meeting Report'[Status]="Planned Meetings")

 

So, I'm trying to accomplish the following:

 

# of Completed Meetings in past 60 days per Name

# of Planned Meetings in the future per Name

 

 

 

 

I always prefer to use the Sum function whenever I can, rather than counting something.  To make sure we are getting the data and to make sure we are not missing something with counting, can you replace the CountRows function and replace it with Sum (Last60Days) and Sum(FutureMeeting)?  

 

Also, do you have a unique Row Index for every line in the data?  I know that sometimes, without a Unique Index/Key/RowID, counting Rows can be problematic.

 

Let me know what you get.

 

Nate

@Nhallquist

 

I tried it and I got this.  Looks like the account name and their totals are accurate, just the overall quota seems way off.  It's not totaling correctly

 

 

Capture3.JPG

Check the settings of your value field, and make sure that some weird setting isn't checked.

 

Table Object Properties.JPG

@Nhallquist

 

Everything looks ok.

 

Capture4.JPG

Completed60 = sum('Invoked Function'[Last60Days])

PlannedFuture = Sum('Invoked Function'[FutureMeeting])

 

Last60Days = (IF(AND([Date] >= [Today]-60, [Date] <= [Today]),1,0))

FutureMeeting = If([Date]>Today(), 1,0)

 

Is there a way just to not show the Total at all?

 

 

you should be able to just check the menu item from above that states "Don't Summarize".  

@Nhallquist

 

Now it's just saying 1 or 0 for each one.  saying "true" or "false" that they had that type of meeting in the past 60 days.

 

I think I have to change the formula in for 

 

Last60Days = (IF(AND([Date] >= [Today]-60, [Date] <= [Today]),1,0))

 

FutureMeeting = If([Date]>Today(), 1,0)

 

Like it meets the Date condition, something like count it, instead of true/false.  Any ideas on the type of formula to use?  Thanks!

 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors