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
smartp121
New Member

Need help on a Row level data Calculation

Hi Friends,


I need some help with this calculation, Don't know how to make this work

 

I have data in the following format 

 

YearMonthRevenue MTD Revenue 
20204  489,611 
20205  308,211             31,404
20206  277,696                  991
20207  277,696             20,907
20208  284,882             28,899
20209  274,322               5,106

 

The MTD Revenue calculation should be like Month month 5 - Month 4 = month 5 MTD, similar to the remaining months.

 

please help me with this calculation.

11 REPLIES 11
Anonymous
Not applicable

Hi   @smartp121 ,

 

It should have nothing to do with TotalDirectRevenue. This error is mainly EARLIER('Projects’[Revenue Month]), Parameter is not the correct type.

 

You can see whether MTD_Revee uses a calculated column or a measure, because the EARLIER function cannot be used for measure, and an error will occur

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Anonymous
Not applicable

Hi  @smartp121,

 

Are you using a calculated column or a measure?

For measure, it is not possible to use the earlier function

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @Anonymous ,

 

The column Projects'[TotalDirectRevenue] is coming from the DB, I renamed it to PTD Direct Revenue Recognized at the report level,

 

it's not a measure or calculated column

 

its Datatype in the DB is Float 

 

 

 

Anonymous
Not applicable

Hi  @smartp121 ,

 

Here are the steps you can follow:

1. Create calculated column.

MTD_Revenue =
var _mtd=
CALCULATE(SUM('Table (2)'[PTD Direct Revenue Recognized]),FILTER('Table (2)','Table (2)'[Month]=EARLIER('Table (2)'[Month])))
-
CALCULATE(SUM('Table (2)'[PTD Direct Revenue Recognized]),FILTER('Table (2)','Table (2)'[Month]=EARLIER('Table (2)'[Month])-1))

return IF('Table (2)'[Month]=4,'Table (2)'[PTD Direct Revenue Recognized],_mtd)
MTD_HXC =
var _mtd=
CALCULATE(SUM('Table (2)'[PTD HxC]),FILTER('Table (2)','Table (2)'[Month]=EARLIER('Table (2)'[Month])))
-
CALCULATE(SUM('Table (2)'[PTD HxC]),FILTER('Table (2)','Table (2)'[Month]=EARLIER('Table (2)'[Month])-1))

return IF('Table (2)'[Month]=4,BLANK(),_mtd)

2. Result.

v-yangliu-msft_0-1605073402190.png

 

You can downloaded PBIX file from here.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

Hi @Anonymous  (Liu)

 

Thanks for the calculation , I'm getting below error, any help pls 

 

smartp121_0-1605076766751.png

 

Anonymous
Not applicable

Hi  @smartp121 ,

 

According to your calculation rules, The MTD Revenue calculation should be like Month month 5-Month 4 = month 5 MTD.

 

The situation should look like the following table:

v-yangliu-msft_0-1605058027731.png

 

For example, May’s MTD Revenue should be -181400, but your MTD Revenue is 31404.

 

If my answer is not what you need, can you share sample data and sample output in table format? Or a sample pbix after removing sensitive data.

 

Best Regards,

Liu Yang

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

@Anonymous 

 

smartp121_0-1605072941103.png

 

you can see the calculation in the fig above 

 

MTD Revenue is D7-D6 and I need to calculate MTD Revenue column, ( Column J)

 

 

smartp121
New Member

Hi @camargos,

 

sorry, I missed explaining something,

 

Column D should be my Result 

 

This report has a filter on Year so when I put a filter on Year the Column D should populate automatically based on calculation.

 

YearMonthRevenue MTD Revenue 
20204  489,611 
20205  308,211             31,404
20206  277,696                  991
20207  277,696             20,907
20208  284,882             28,899
20209  274,322               5,106
camargos88
Community Champion
Community Champion

@smartp121 ,

 

Check the attached file.

 

Capture.PNG



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



camargos88
Community Champion
Community Champion

@smartp121 ,

 

Can you explain more the logic here ? 



Did I answer your question? Mark my post as a solution!

Proud to be a Super User!



@camargos88  the issue is to identify the calculation logic to calculate the MTD Revenue, 

 

The MTD Revenue of Month 5  = Reven of Month 5 - Revenue of Month 6

 

how do I put this together in a calculation how to subtract row data ?

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