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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
Anonymous
Not applicable

Help needed in getting rolling numbers for dates

Hi Team,

I'm seeking some help in achieving the below scenario in PowerBI which we can easily get using Excel formula. 

Gurunadhs_0-1618237035801.png

I want to get the total no. of applications for each date ("Tme" column could be any date) calculated from the before date in the column.

I was thinking it is easy but I'm not getting the trick/logic to apply.

Can anyone help..?

Thanks in advance.

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

Hi, @Anonymous 

According to your description, what I understand is that only the first row of the application count column has a value, and the values of the remaining rows are calculated by the formula: A-B+C.

If it is what I think it is, please see my solution.

Sample data:

v-angzheng-msft_0-1618480405375.jpeg

If you want to get the same results as in Excel, we can create the following metasure:

 

Measure =
CALCULATE(
    SUM('Table'[Applications count]),
    FILTER(ALL('Table'),[Time]<=MAX('Table'[Time]))
)
-
CALCULATE(
    SUM('Table'[Deprictae]),
    FILTER(ALL('Table'),[Time]<MAX('Table'[Time]))
)
+
CALCULATE(
    SUM('Table'[New Add]),
    FILTER(ALL('Table'),[Time]<MAX('Table'[Time]))
)

 

v-angzheng-msft_1-1618480405379.jpeg

Or we can achieve the same result by creating calculated columns.

What I did is to calculate the first value of Applications count column with the row-by-row accumulation of the remaining two columns

I created 3 columns to be used as auxiliary calculations, the DAX is as follows:

 

Column = CALCULATE(MAX('Table'[Applications count]),FILTER('Table',[Time]<=EARLIER('Table'[Time])))
Column 2 = CALCULATE(SUM('Table'[Deprictae]),FILTER('Table',[Time]<EARLIER('Table'[Time])))
Column 3 = CALCULATE(SUM('Table'[New Add]),FILTER('Table',[Time]<EARLIER('Table'[Time])))

 

So the expression of the final result is very simple:

 

Result = [Column]-[Column 2]+[Column 3]

 

Result:

v-angzheng-msft_2-1618480405383.jpeg

Please check the sample pbix file's link down below

 

Is this the result you want? Hope this is useful to you

Please feel free to let me know If you have further questions

 

Best Regards,
Community Support Team _ Zeon Zheng
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

3 REPLIES 3
v-angzheng-msft
Community Support
Community Support

Hi, @Anonymous 

According to your description, what I understand is that only the first row of the application count column has a value, and the values of the remaining rows are calculated by the formula: A-B+C.

If it is what I think it is, please see my solution.

Sample data:

v-angzheng-msft_0-1618480405375.jpeg

If you want to get the same results as in Excel, we can create the following metasure:

 

Measure =
CALCULATE(
    SUM('Table'[Applications count]),
    FILTER(ALL('Table'),[Time]<=MAX('Table'[Time]))
)
-
CALCULATE(
    SUM('Table'[Deprictae]),
    FILTER(ALL('Table'),[Time]<MAX('Table'[Time]))
)
+
CALCULATE(
    SUM('Table'[New Add]),
    FILTER(ALL('Table'),[Time]<MAX('Table'[Time]))
)

 

v-angzheng-msft_1-1618480405379.jpeg

Or we can achieve the same result by creating calculated columns.

What I did is to calculate the first value of Applications count column with the row-by-row accumulation of the remaining two columns

I created 3 columns to be used as auxiliary calculations, the DAX is as follows:

 

Column = CALCULATE(MAX('Table'[Applications count]),FILTER('Table',[Time]<=EARLIER('Table'[Time])))
Column 2 = CALCULATE(SUM('Table'[Deprictae]),FILTER('Table',[Time]<EARLIER('Table'[Time])))
Column 3 = CALCULATE(SUM('Table'[New Add]),FILTER('Table',[Time]<EARLIER('Table'[Time])))

 

So the expression of the final result is very simple:

 

Result = [Column]-[Column 2]+[Column 3]

 

Result:

v-angzheng-msft_2-1618480405383.jpeg

Please check the sample pbix file's link down below

 

Is this the result you want? Hope this is useful to you

Please feel free to let me know If you have further questions

 

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

Anonymous
Not applicable

Thanks, @v-angzheng-msft 
This is what I'm looking at.

Jihwan_Kim
Super User
Super User

Hi, @Anonymous 

Please check the below picture and the sample pbix file's link down below, whether it is what you are looking for.

I created the sample and please check whether it suits your business case.

 

Picture2.png

 

Result =
VAR currentdate =
MAX ( 'Table'[Date] )
RETURN
CALCULATE (
LASTNONBLANKVALUE (
'Table'[Date],
SUMX (
'Table',
'Table'[Applications Count] - 'Table'[Deprictae] + 'Table'[New Add]
)
),
FILTER ( ALLSELECTED ( 'Table' ), 'Table'[Date] < currentdate )
)

 

 

https://www.dropbox.com/s/ovb5eql4n4uvf92/gurunadhs.pbix?dl=0 

 

Hi, My name is Jihwan Kim.

If this post helps, then please consider accept it as the solution to help other members find it faster, and give a big thumbs up.


If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.


Click here to visit my LinkedIn page

Click here to schedule a short Teams meeting to discuss your question.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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