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

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
bolabuga
Helper V
Helper V

Measure Doubt.

Hello

 

i would like to create a measure that do the following:

 

MEASURE = (MONTH) - (LASTMONTH)

 

The idea is to use the variance to make a waterfall chart showing 2 years (24 months)

1 ACCEPTED SOLUTION
v-haibl-msft
Microsoft Employee
Microsoft Employee

@bolabuga

 

You can try with PREVIOUSMONTH function as smoupre said. Just give a simple sample as below. Assuming we have a sales table from 1/1/2014 to one day in 2017.

 

Measure Doubt._1.jpg

 

We can create a Calendar table firstly with following DAX formula. Create relationship with the sales table with date key. Put this Calendar[Date] column into the Slicer visual.

Calendar =
    CALENDAR ( "1/1/2014", "12/31/2017" )

Create a PreMonthSales and a Diff measure. Drag them into the Waterfall chart.

PreMonthSales = 
CALCULATE ( SUM ( Table1[Sales] ), PREVIOUSMONTH ( Table1[Date] ) )
MEASURE = 
CALCULATE ( SUM ( Table1[Sales] ) - [PreMonthSales] )

I've also uploaded the PBIX file here for reference.

Measure Doubt._2.png

 

Best Regards,

Herbert

View solution in original post

3 REPLIES 3
v-haibl-msft
Microsoft Employee
Microsoft Employee

@bolabuga

 

You can try with PREVIOUSMONTH function as smoupre said. Just give a simple sample as below. Assuming we have a sales table from 1/1/2014 to one day in 2017.

 

Measure Doubt._1.jpg

 

We can create a Calendar table firstly with following DAX formula. Create relationship with the sales table with date key. Put this Calendar[Date] column into the Slicer visual.

Calendar =
    CALENDAR ( "1/1/2014", "12/31/2017" )

Create a PreMonthSales and a Diff measure. Drag them into the Waterfall chart.

PreMonthSales = 
CALCULATE ( SUM ( Table1[Sales] ), PREVIOUSMONTH ( Table1[Date] ) )
MEASURE = 
CALCULATE ( SUM ( Table1[Sales] ) - [PreMonthSales] )

I've also uploaded the PBIX file here for reference.

Measure Doubt._2.png

 

Best Regards,

Herbert

Thks herbert, that was just what i needed :).

Greg_Deckler
Community Champion
Community Champion

Sounds like you need the PREVIOUSMONTH function:

 

https://msdn.microsoft.com/en-us/library/ee634758.aspx

 

Can't really say much more without sample data.



Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.