Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I'm unable to create a calculated table where I'm trying to group the following margin% by cities and arrive at 2 columns: current month margin% and previous month margin%. I have tried several formulae: previousmonth, dateadd and it does not seem to work.
please help!!
dataset:
dax used:
desired outcome:
Solved! Go to Solution.
@Ancella OK, see attached PBIX file below signature:
Current Month =
VAR __MaxMonth = MONTH( MAX( 'Table'[Beg_of_month] ) )
VAR __Result = AVERAGEX( FILTER( 'Table', MONTH( [Beg_of_month] ) = __MaxMonth ), [Margin %] )
RETURN
__Result
Last Month =
VAR __MaxMonth = MONTH( MAX( 'Table'[Beg_of_month] ) )
VAR __Result = AVERAGEX( FILTER( 'Table', MONTH( [Beg_of_month] ) = __MaxMonth - 1 ), [Margin %] )
RETURN
__Result
Hi @Ancella - can you try the below calculated table and rename the source tables at your end.
Hope it works, still any please share some sample data will check on this.
Proud to be a Super User! | |
Hi @rajendraongole1 ,
Thank you for the solution. But as per your table Previous month margin% seems to be empty.
Upon applying it to my dataset also I get an empty column. Can you please help with a column that would populate the column:
refer "Margin last month"
@rajendraongole1 Can you share the sample data you posted as text?
Hi @Greg_Deckler ,
thank you for your response.. I can share my sample dataset, if this works.
Please note: Margin% column is a calculated measure.. while I'm trying to create a calculated table with current month and previous month margins, none of the time intelligence functions work.. they're either showing empty results or same values as current month
Hi,
Why do you want to create a calculated table? Why not a measure?
@Ancella OK, see attached PBIX file below signature:
Current Month =
VAR __MaxMonth = MONTH( MAX( 'Table'[Beg_of_month] ) )
VAR __Result = AVERAGEX( FILTER( 'Table', MONTH( [Beg_of_month] ) = __MaxMonth ), [Margin %] )
RETURN
__Result
Last Month =
VAR __MaxMonth = MONTH( MAX( 'Table'[Beg_of_month] ) )
VAR __Result = AVERAGEX( FILTER( 'Table', MONTH( [Beg_of_month] ) = __MaxMonth - 1 ), [Margin %] )
RETURN
__Result
@Ancella OK, I'll take a look. In the mean time, you may find this helpful - https://community.powerbi.com/t5/Community-Blog/To-bleep-With-Time-Intelligence/ba-p/1260000
Also, see if my Time Intelligence the Hard Way provides a different way of accomplishing what you are going for.
https://community.powerbi.com/t5/Quick-Measures-Gallery/Time-Intelligence-quot-The-Hard-Way-quot-TIT...
Check out the November 2025 Power BI update to learn about new features.
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!