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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Anonymous
Not applicable

How to compute the Different of ROLL_12_SALES and ROLL_24_SALES ?

Hi All

 

I need to compute the different of below 2 expression :-

 

ROLL_12_SALES = CALCULATE(sum(SALES[sales]),DATESINPERIOD('Date'[Date],MAX(SALES[date]),-12,MONTH))
 
ROLL_24_SALES = CALCULATE(SUM(SALES[sales]), DATESINPERIOD('Date'[Date], maxx('Date', DATEADD('Date'[Date],-12,MONTH)),-12, MONTH))
 
Can some one advise me ?
 
Paul
1 ACCEPTED SOLUTION
themistoklis
Community Champion
Community Champion

@Anonymous 

 

Have you tried creating a new measure with the following calculation

Measure = [ROLL_24_SALES] - [ROLL_12_SALES]

 

Or another option is the following:

Difference = 
var _ROLL_12_SALES = CALCULATE(sum(SALES[sales]),DATESINPERIOD('Date'[Date],MAX(SALES[date]),-12,MONTH))
 
var _ROLL_24_SALES = CALCULATE(SUM(SALES[sales]), DATESINPERIOD('Date'[Date], maxx('Date', DATEADD('Date'[Date],-12,MONTH)),-12, MONTH))

Return
_ROLL_24_SALES - _ROLL_12_SALES

 

View solution in original post

3 REPLIES 3
themistoklis
Community Champion
Community Champion

@Anonymous 

 

Have you tried creating a new measure with the following calculation

Measure = [ROLL_24_SALES] - [ROLL_12_SALES]

 

Or another option is the following:

Difference = 
var _ROLL_12_SALES = CALCULATE(sum(SALES[sales]),DATESINPERIOD('Date'[Date],MAX(SALES[date]),-12,MONTH))
 
var _ROLL_24_SALES = CALCULATE(SUM(SALES[sales]), DATESINPERIOD('Date'[Date], maxx('Date', DATEADD('Date'[Date],-12,MONTH)),-12, MONTH))

Return
_ROLL_24_SALES - _ROLL_12_SALES

 

Anonymous
Not applicable

Hi Themistoklis

Thank you very much for your sharing , it work fine now.

Paul

aj1973
Community Champion
Community Champion

@Anonymous 

ROLL_24_SALES     is not correct! you have 2 time intelligence formulas in a same measure!

What do you to do?

 

Regards
Amine Jerbi

If I answered your question, please mark this thread as accepted
and you can follow me on
My Website, LinkedIn and Facebook

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.

Users online (4,217)