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
Anonymous
Not applicable

Unable create measure for rolling PROFIT

Hi All

I have create a measure below work fine :-

PROFIT = SALES[SALES_]-SALES[COST_]

Paulyeo11_0-1609071374540.png

When i try to create a rolling profit i get error :-

 

Paulyeo11_0-1609071565241.png

It cannot detect SALES[PROFIT]

May i know why ?

 

Paul

 

1 ACCEPTED SOLUTION
AllisonKennedy
Super User
Super User

@Anonymous 

 

Try to delete SUM('Sales' from before profit. Profit is a measure so you don't need to sum it again.

Rolling 12 Month = CALCULATE([Profit], DATESINPERIOD( ...

continue the rest of your measure as is.

 

DAX best practice naming convention says:

1) When referring to COLUMN - put table name in front: Table[Column]

2) When referring to MEASURE - do NOT put table name in front: [Measure]

 

This is good practice to follow, as measures do not belong to a table. They must be unique across the entire data model. It is also possible to change the 'home table' of a measure. Finally, DAX gurus expect this naming convention, so it's easier for us to read your code if you follow it. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

View solution in original post

4 REPLIES 4
v-jingzhang
Community Support
Community Support

Hi @Anonymous , has this problem been solved? If so, kindly accept the proper reply as the solution. More people will benefit from it. Otherwise if you are still confused about it, please provide more details about your problem. Thanks a lot.


Best Regards,
Community Support Team _ Jing Zhang

parry2k
Super User
Super User

@Anonymous  @AllisonKennedy provided the correct solution. Also when you are referring to Measures in your calculations, don't use a Table name with the measure. Measures are global to your model and as a best practice, don't use table names when using measures in another measure.

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

amitchandak
Super User
Super User

@Anonymous , to me profit seem like a measure. If it is a measure sum will not work. Sumx Can

 

calculate(Sumx(Table, [Profit]),DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

 

Or simply measure

calculate( [Profit],DATESINPERIOD('Date'[Date ],MAX('Date'[Date ]),-12,MONTH))

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
AllisonKennedy
Super User
Super User

@Anonymous 

 

Try to delete SUM('Sales' from before profit. Profit is a measure so you don't need to sum it again.

Rolling 12 Month = CALCULATE([Profit], DATESINPERIOD( ...

continue the rest of your measure as is.

 

DAX best practice naming convention says:

1) When referring to COLUMN - put table name in front: Table[Column]

2) When referring to MEASURE - do NOT put table name in front: [Measure]

 

This is good practice to follow, as measures do not belong to a table. They must be unique across the entire data model. It is also possible to change the 'home table' of a measure. Finally, DAX gurus expect this naming convention, so it's easier for us to read your code if you follow it. 


Please @mention me in your reply if you want a response.

Copying DAX from this post? Click here for a hack to quickly replace it with your own table names

Has this post solved your problem? Please Accept as Solution so that others can find it quickly and to let the community know your problem has been solved.
If you found this post helpful, please give Kudos C

I work as a Microsoft trainer and consultant, specialising in Power BI and Power Query.
www.excelwithallison.com

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

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!

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