cancel
Showing results for
Did you mean:
Anonymous
Not applicable

## Roll back date of measure in PowerBI

Hello!

I hope it's clear what I am trying to achieve. I am basically comparing two different measures to get a market share. For example:

Phones sold by company / Phones sold by market

However what I would like is to have the same thing but moving back one of the measures, for example three months being:

Phones sold by company (six months ago) / Phones sold by market

Basically I am trying to achieve to move back the date of the first measure by six months. I am trying to use DATEADD as filter like:

CALCULATE ( Phones sold by company, DATEADD ( 'Calendar'[Date], -6, MONTH ) ) / Phones sold by market

So then any calculation I make will have this date rolled back whether I do it by months, years, etc. I believe it's wrong and should not be a filter.
I get an error saying that a function dateadd has been used in a True False expression taht is used as a table filter expression.

Thanks!
1 ACCEPTED SOLUTION
Super User

Seem fine, Just try with some other measure.

The only doubt neither the agg is used nor field is used as a measure

CALCULATE ( [Phones sold by company], DATEADD( 'Calendar'[Date], -6, MONTH ))
CALCULATE ( [Phones sold by company], datesmtd(DATEADD( 'Calendar'[Date], -6, MONTH )))

CALCULATE ( sum(Table[Phones sold by company]), DATEADD( 'Calendar'[Date], -6, MONTH ))
CALCULATE ( sum(Table[Phones sold by company]), datesmtd(DATEADD( 'Calendar'[Date], -6, MONTH )))

Check position of (  and )

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges

2 REPLIES 2
Super User

Seem fine, Just try with some other measure.

The only doubt neither the agg is used nor field is used as a measure

CALCULATE ( [Phones sold by company], DATEADD( 'Calendar'[Date], -6, MONTH ))
CALCULATE ( [Phones sold by company], datesmtd(DATEADD( 'Calendar'[Date], -6, MONTH )))

CALCULATE ( sum(Table[Phones sold by company]), DATEADD( 'Calendar'[Date], -6, MONTH ))
CALCULATE ( sum(Table[Phones sold by company]), datesmtd(DATEADD( 'Calendar'[Date], -6, MONTH )))

Check position of (  and )

Appreciate your Kudos. In case, this is the solution you are looking for, mark it as the Solution.
In case it does not help, please provide additional information and mark me with @

Thanks. My Recent Blogs -Decoding Direct Query - Time Intelligence, Winner Coloring on MAP, HR Analytics, Power BI Working with Non-Standard TimeAnd Comparing Data Across Date Ranges

Anonymous
Not applicable

Apologies, I believe there was an error in my formula. Now seems to work correctly

Announcements

#### Power BI T-Shirt Design Challenge 2023

Vote for your favorite t-shirt design now through March 28.

#### Power BI March 2023 Update

Find out more about the March 2023 update.

#### March 2023 Events

Find out more about the online and in person events happening in March!

Top Solution Authors
Top Kudoed Authors