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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Rck7
Helper II
Helper II

How to calculate conditional running totals in Power BI?

Hi Friends,

I have a date column with dates starting from 27-OCT-2014 to current. I have created a column chart which displays the data on contract year basis.

For example:

Contract year 1 has dates from 27-OCT-2014 to 26-oct-2017.

contract year 2 has dates from 27-oct-2017 to 26-oct-2020 and follows the same for the years to come.

I have created a running total measure which is currently giving me the total of the entire table including the contract year 2. Instead, I would like to create a measure which calculates the running total starting from 27-oct-2017 and upcoming months(as I have entered the year 2 not including year 1).

Additionally, I would aslo like to create a measure to calculate projected running totals for the contract year 2 (i.e. 62000/month).
Here are my measures:
Running totals: 
Contract year2 Totals =
CALCULATE (
FILTER (
ALL (TokenRecords[UsageDate]),
TokenRecords[UsageDate] >= DATE (10,27,2017 )
&& TokenRecords[UsageDate] <= MAX (TokenRecords[UsageDate])
)
)

Projected totals:
Projected Totals =
COUNTROWS (
SUMMARIZE ( TokenRecords, TokenRecords[FiscalYear], TokenRecords[FiscalMonth]))*62891


Any help would be very much appreciated. 
Thank you.


1 ACCEPTED SOLUTION

Hi @Rck7,

 

Try this

 

=CALCULATE(SUM(Tokenrecords[amount]),DATESBETWEEN(Calendar[Date],DATE(2017,10,1),TODAY()))

 

I have assumed that you have a table named calendar with running dates.  There is a relationship from the Date column of the TokenRecords table to the Date column of the Calendar table.

 

Hope this helps.


Regards,
Ashish Mathur
http://www.ashishmathur.com
https://www.linkedin.com/in/excelenthusiasts/

View solution in original post

10 REPLIES 10

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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